The “if – else” statement: -
This statement is also called a conditional statement structure like simple if statement. But there is some extra statement ELSE is used with false case.
The syntax will be as:
If (condition)
Statement 1;
Else
Statement 2;
So in the above structure first of all condition is checked if it become true then statement 1 will be executed and if it become false then statement 2 will be executed.
If this kind of statement will compound then its syntax will be as:
If (condition)
{
Statement 1;
Statement 2;
}
Else
{
Statement 3;
Statement 4;
}
Posted by: Wasim Javed
No comments:
Post a Comment