STEP 4: We have one last variable to set up that we will need right away.

  • Drag out String Variable and change its name from my_var to choice.
  • You don't need to change the value of choice. At the moment it doesn't matter!

We need to create choice now so that we can use it without errors. At the end of each level in our game, we will ask the user a question and store their answer in choice. Their answer will determine whether they play again or not!

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)