LOOPS Flashcards
What does include a for loop ?
Includes an iterator variable that usually appears in all three expressions. The iterator variable is initialized, checked against the stopping condition, and assigned a new value on each loop iteration. Iterator variables can have any name, but it’s best practice to use a descriptive variable name.
What is an initialization in a FOR loop?
One of the three expressions of an iterator variable :
> that’s starts the loop and can also be used to declare the iterator variable.
What is a stopping condition in a FOR loop?
One of the three expressions of an iterator variable :
> is the condition that the iterator variable is evaluated against— if the condition evaluates to true the code block will run, and if it evaluates to false the code will stop.
What is an iteration statement in a FOR loop?
One of the three expressions of an iterator variable :
> used to update the iterator variable on each loop.
What does the iteration statement is counter++ means?
This means after each loop, the value of counter will increase by 1.
What do we call a loop running inside another loop?
We call that a nested loop
What is the difference between the while loop and the do… while?
Unlike the while loop, do…while will run at least once whether or not the condition evaluates to true.