elseControlConditionalsWeb & Applicationelse.gif
for(int i = 5; i < 95; i += 5) {
if(i < 35) {
line( 30, i, 80, i );
} else {
line( 20, i, 90, i );
}
}
else2.gif
for(int i = 5; i < 95; i += 5) {
if(i < 35) {
line( 30, i, 80, i );
} else if (i < 65) {
line( 20, i, 90, i );
} else {
line( 0, i, 100, i );
}
}
Extends the if() structure allowing the program to choose between two or more block of code. It specifies a block of code to execute when the expression in if() is false.
if(expression) {
statements
} else {
statements
}
if(expression) {
statements
} else if(expression) {
statements
} else {
statements
}
any valid expression that evaluates to true or falseone or more statements to be executed
if()
1.0KeywordPDE