Selasa, 18 Desember 2018

Materi: Repetition

REPETITION


Pada topik ini, saya mempelajari tentang Program Control - Repetition yang terdiri dari 

- For
- While 
- Do-While 
- Break 
- Continue 

For:
for(exp1; exp2; exp3) statement;
or:
for(exp1; exp2; exp3){
statement1;
statement2;
…….
 }

exp1 :  initialization (Inisialisasi nilai)
exp2 :  conditional (Kondisi kapan dia bakal berhenti)
exp3 :  increment or decrement (menambah/mengurangi nilai)
exp1, exp2 and exp3 are optional


While: 

while (exp) statements;
or:
while(exp){
statement1;
statement2;
   …..
}


Do While: 

do{
    < statements >;
} while(exp);

Keep executing while exp is true 
exp evaluation done after executing the statement(s)

Break: 

ending loop (for, while and do-while)
end the switch operation

Continue: 
skip all the rest of statements (subsequent to the skip statement) inside a repetition, and continue normally to the next loop





Tidak ada komentar:

Posting Komentar

Materi: Function dan Recursion(Recursive)

FUNCTION AND RECURSION(RECURSIVE) Function:  is a structure, grouping that contains a group of statements that will be carried out by t...