STEP 12: The computer now knows the player has won, but we need to escape the loop.

The break command stops a loop, even if it's still running.

  • In LOGIC, click on and drag in Break to the bottom of your if statement.
  • Change the .say() text inside the if statement to "You guessed my word!".
  • Click Run and enter the correct word on your first try. See how the program stops!

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)