A for loop opens copies of containers. Each time it needs to wait for action in the container and then move to the next iteration.
However a loop that says open container with each iteration doesn’t wait. It opens all the containers on top of each other.
How can I get the loop to wait for action?
You can’t. You need to rethink your approach. Unroll the “loop” concept and make each iteration distinct. Open the next container in response to the action you’re expecting in the current container.
Need a pause: lets have a nap ?
- Blondie comic strip have the nap specialist: Dagwood.
Todays strip (about pizza):
It runs with what Tim H suggested - create your containers in a sort of linked-list organization
Open Container 1
Next container is 2
previous container is Nil
Get user input
Open Next Container passing 3 (next) and 1 (previous)
Increment next and previous as you go so you always know what’s next and where you came from in case you need to go backwards.