Tuesday, December 18, 2018

Repetition

FOR

harus memiliki 2 ;; dan loop sudah bisa berjalan
for (exp1;exp2;exp3)
exp1: inialisasi
exp2: condisi
exp3: increment atau decrement

WHILE

selama masih memenuhi exp1 maka loop terus berjalan
while (exp1)
exp1: boolean expresion

DO WHILE

selama masih memenuhi exp maka loop terus berjalan
do{ statement } while (exp)

BREAK  & CONTINUE

break untuk menghentikan loop bila memnuhi ekspresi tertentu
continue untuk tetap melanjutkan loop bila memenuhi ekspresi tertentu

No comments:

Post a Comment