Algoritma

dipertemuan 3 ini membahas :

– selection
– If
– If-Else
– Nested if
– Program Examples using if
– Switch-Case
– ?: Operator
– dan tipe-tipe error

IF : untuk menjalankan program dalam bentuk pilihan

if(bool exp) statement

IF else : jika pilihan lebih dari 1

if(bool exp) statement1;
else statement2

Nested IF adalah adanya If di dalam If

SWITCH

switch(exp){
Case const1: statement1; break;
Case const2: statement2; break;
Case constN: statementN; break;
default: statement;
}

TERNARY

variable = (a>b)?a:b;

 

 

 

Category: Uncategorized
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>