Level 51 Level 53
Level 52

[Quiz] Loops

18 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

A statement whose job is to repeatedly execute some other statement(loop body)
The three iteration statements(Loops)
While, do and for
While condition is true, repeats
Performs action at least once, then repeats until the condition is false
Uses a variable initialization, condition, and variable update
Comma operator
Used primarily in for statements.
while (expression) statement
Form of the while statement
Controlling expression
The statement inside the parentheses.
A while statement won't terminate
...if the controlling expression always has a nonzero value. (infinite loop)
Form of the do statement
do statement while (expression) ;
Form of the "for" statement
for (expr1 ; expr2 ; expr3) statement
The for statement
Can be replaced by equivalent while statement when it doesn't need all 3 expressions.
compound statements
Can use brackets around multiple stmt's to treat as a single stmt. if (expression) statement can be if (expression) {statements}
continue statement.....
makes it possible to skip part of a loop iteration without jumping out of the loop. Can only be used in loops.
goto statement.....
allows a program to jump fro one statement to another provided the statement has a label, but rarely used because of availability of break and continue stmts.
break statements...
used to transfer control out of a switch stmt, and used to jump out of a while, do , or for loop.
goto identifier ; statement
Form of a goto statement...
If the first and third expressions of a for statement are removed:
Use a while statement instead.