Loops Flashcards
1
Q
What are the two types of loops
A
Counter-controlled repetition
Sentinel-controlled repetition
2
Q
Counter-controlled repetition
A
Repetition exits after running a certain number of times
3
Q
What does a counter-controlled repetition consist of
A
Control variable that acts as a counter
Control variable needs to be initialised before running the loop
Control variable should be modified each time through loop
The loop-continuation-condition determines if looping should continue.
4
Q
Sentinel-controlled repetition
A
Loop that runs based on a sentinel/signal value which decides when to exit the loop.