![]() |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The most common conditional statement is naturally the if
statement. It's easy to use and can be combined with an else
clause to handle failed tests. It's written like this:
if (expression) statement; e.g. if (a == 5) a -= 4; |
If you want to handle the failed match, you add an else statement like this:
if (expression) true-statement else false-statement; e.g. if (a == 5) a -= 4; else a += 18; |