if-else statement

There are situation where you may want to execute a statement(or a set of statements) when the if condition evaluates to true and another statement(or a set of statement) when the condition evaluates to false. In such cases we make of the if-else statement. The general form of the if-else statement is:
if(test condition)
{
statement-blick;
}
else
{
statement block;
}
statement a;
The test condition is evaluated. if it is true the statement block following if(called the if block) is executed, if it false the statement block following else(called the else block) is executed. The control is subsequently transferred to statement-a. In any cases only one statement block is executed.

No comments:

Post a Comment