FOR LOOPSIteration is when code is executed repeatedly until a condition is met.
We can use it to loop through our code. We are going to look at count controlled loops. So, we are going to count the number of times we do something. These are know as for loops. Double Loop: |
Learning Objectives: We meet Iteration with the Turtle project:
|
Adventure game:
This would output as
>>>
sword
Gem
Rope
Healing potion
>>>
>>>
sword
Gem
Rope
Healing potion
>>>