Minggu, 17 Maret 2013

Posted by Kiki Risky | File under : , ,
Repetition For

As in the previous loop structure code execution repeating several times.

The form of the for loop,

for (InitExpression; LoopCondition; StepExpression) {
statement1;


statement2;
. . .
}


















Repetition While

While statement is a loop statement or statement block is repeated until it reaches a suitable condition.

The form of the while,

while (boolean_expression) {
statement1;
statement2;
. . .
}

 

















Repetition Do..While 

Do-while loop is similar to while-loop. Statement on the do-while loop will be executed multiple times during the condition is true. Difference between while and do-while loop is where the statement in the do-while loop is executed at least once.

The shape of the do-while,

do {
statement1;
statement2;
. . .
} while (boolean_expression);




















Commands break and continue 

break command is used to stop the repetition of activities

break label by adding a label at the beginning to make orders for the outermost break ... label stopped all repetitions.

Continue command is used to pass through existing activities under the order and continued repetition
 

 

0 komentar:

Posting Komentar