Perulangan terbagi menjadi :
-For
-While
-Do-while
contoh syntax for:
for(exp1;exp2;exp3) statement;
atau
for(exp1;exp2;exp3){
statement1;
statement2;
.....
}
exp1 : inisialisasi
exp2 : kondisi
exp3 : increment atau decrement
contoh syntax while:
while (exp) statements;
atau
while (exp){
statement1;
statement2;
....
}
contoh syntax do-while:
do{
<statements>;
}while(exp);
Tidak ada komentar:
Posting Komentar