COP2253 Zybooks Chapter Four Flashcards
loop
a program construct that repeatedly executes the loop’s statements (loop body) while the loop’s expression is true, when false, execution proceeds past the loop
iteration
each time through a loop’s statements
infinite loop
loop that never stops iterating
loop expression should describe
when the loop should iterate, not when it should terminate
sentinel value
a special value indicating the end of a list
do-while loop
loop constructs that first executes the loop body’s statements, then checks the loop condition
for loop
loop with three parts at the top: a loop variable initialization, a loop expression, and a loop variable update. iterates a specific number of times.
increment operator
++
decrement operator
–
break statement
in a loop, causes an immediate exit of the loop
continue statement
causes an immediate jump to the loop condition check
scope
the region of code where a declared name is valid
enumeration type (enum)
declares a name for a new type and possible values for that type