WARNING: This program has a logic error! It should stop asking questions once giving you a snack.

RULE: Use break to exit a loop when a particular condition is met.

  • Click Run and request a snack from the vending machine.
  • Fix the program by putting break at the bottom of the else statement.
  • Click Run to see if you fixed the program. When it is fixed, click Submit and Next.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)