Repetition Flashcards
for
use when you know how many times to repeat the loop
for index=expression
commands to be executed
end
while
used when you need to repeat a loop until a criterion is met
while expression
commands to be executed
end
if expression is true, the commands will be repeated until it becomes false; then the program will skip over the commands and execute first command after end
(find one condition that must be true after the loop, use the OPPOSITE of that condition for the loop expression)
break
used to terminate a loop prematurely; ends smallest enclosing for or while loop
continue
causes a detour of the program, skips to next pass
nested loop
complete for/while loop inside another for/while loop