If else Control Structure

If else Control Structure


The if else control structure is used where either of two action are to be performed depending upon the result of a conditional expression. It contains two block of statement. If the conditional expression evaluates to true, the statement(s) in if block are executed and if the result is false, then statement(s) in the else block get executed.

Syntax:

if(conditional expression)
{
statement 1
statement 2
……………
}
else
{
statement 1
statement 2
……………
}