1.1. What can we do with the while statement?
Loop a sequence of code until specific conditions are met.
1.2. What value needs the statement in the brackets evaluate to in order for the loop to continue?
While true, keep going.
1.3. What is an infinite loop?
A loop gets executed for ever. A loop from which we never exit and the code execution is stuck in it.
1.4. What is an iteration?
One lap of the loop.
2.1. When is it a good idea to use a for statement (do a for loop) instead of the while loop we learned previously?
When you know the exact number of iterations of a loop is required to execute a desired task.
2.2 How would you write a for-loop in code?
for (init-statement; condition-expression; end-expression)
statement
2.3. What is an off-by-one error?
It’s when the loop iterates one too many or one too few times. Often a beginner mistake.