Program Control
Repetition

what's a repetition?
repetition is a function to one or more than one instructions repeated in a time.

type of repetition you can use:
- for
- do-while
- while

repetition for
the loop is going forever as long as they are fit in the condition, the loop stop when it doesnt meet the condition.
syntax:
for(initialization; condition; increment or decrement) {
      statement(s)}


repetition do-while
the loop will still doing itself at least once even tho the condition is wrong or doesnt fit.
dowhile is usually used for validation.
do{
statement(s)}
while();

repetition while
the loop is checking the condition first, before they doing their loops.
while(condition) {
statement(s)}



Comments