If – Else Statement
,if else Statement
• It is a two way selection statement
• If the test condition is true then statements immediately following
statements are executed
• Otherwise the false block statements are executed
• In short either true-block or false-block of statements will be execu
not both
, if else Statement - structure
• The if else statement is an extension of the simple if statement.
• The general form is :
if (Expression) ✓ If and else are a keyword
{ ✓ Expression is evaluated to true or
True block statements; ✓ If Expression is true,
then ‘True block statements’ wil
} executed;
else ✓ If Expression is false,
{ then ‘False block statements’ wi
False block statements; executed;
} ✓ After executing True or False bloc
statement-x; statement-x is executed
,if else Statement
• It is a two way selection statement
• If the test condition is true then statements immediately following
statements are executed
• Otherwise the false block statements are executed
• In short either true-block or false-block of statements will be execu
not both
, if else Statement - structure
• The if else statement is an extension of the simple if statement.
• The general form is :
if (Expression) ✓ If and else are a keyword
{ ✓ Expression is evaluated to true or
True block statements; ✓ If Expression is true,
then ‘True block statements’ wil
} executed;
else ✓ If Expression is false,
{ then ‘False block statements’ wi
False block statements; executed;
} ✓ After executing True or False bloc
statement-x; statement-x is executed