Escape Room Program – Part 2: making decisions

Step 3 – Fix the Loop problem

Our program runs wild if you don't enter "light". There's a good reason for that...

It's simple: we need to ask them what they want to do again, but this time at the bottom of the while loop. Otherwise the value of the action variable never changes.

This is easy to fix:

  1. Code helper imageAdd code to the ELSE part of the IF – ELSE block to ask the question again

    You can copy and paste code by using Edit > Copy and Edit > Paste from the top menu. But make sure you get the indents right

  2. Run the program again. It should keep asking you what to do rather than running wild

    As soon as you type in "light" the program should end

Now do: add to your description of the room to make your program more atmospheric.