Loops Flashcards
Loop
Repeatedly executes specific code
While Loop
Repeatedly executes specific code as long as some condition is true
Used when user interaction is evaluated
Loop Body
Sub-statements inside braces
Iteration
Each execution of the loop body
Infinite Loop
Loop that always executes because expression always evaluates to true
Loop Variable
Counts the number of loop iterations
For Loop
Executes for n number of iterations
Used when programmer knows how many iterations will occur
Nested Loop
Loop (inner loop) that appears in the body of another loop (outer loop)
Do-while Loop
First executes loop body’s statements then check loop condition
Break Statement
Causes immediate exit of a loop
Listed as a if statement
Continue Statement
Causes an immediate jump to the next loop iteration, even if there is still loop body that hasn’t been executed