if ( )
statement;
else
statement;
|
"If" executes the next statement only if the boolean expression evaluates to "true". If there is an "else" block, it gets executed if the expression evaluates to "false".
The statements that are executed are often block statements.
Example:
if (i == 4)
{
writef("i is equal to 4");
} else {
writef("i is not equal to 4");
}
|
It is also possible to make multiple constructs of if-else, they work as you expect them to work:
if(i == 4)
{
}
else if(i == 5)
{
}
else
{
}
|
|