Save
COM PROG
MOD 3
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Rose 0801
Visit profile
Cards (11)
Repetition control structures
are Java statements that allows to execute specific blocks of code a number of times.
Three types of repetition control structures:
for loops
while
do-while
For loop
allows execution of the same code a number of times
Initialization
- initializes the loop variable.
Condition
- compares the loop variable to some limit value
Step / iteration
- updates the loop variable
For
statement:
Initialization
Condition
Step / iteration
while loop
- statement or block of statements that is repeated as long as some condition is satisfied.
The statements inside the while loop are executed as long as the boolean_expression evaluates to
true
The statements inside a
do-while loop
are executed several times as long as the condition is satisfied.
The main difference between a while and do-while loop is that, the statements inside a
do-while loop
is executed at least one