Discuss if else statement
If else :- This is a bi-directional selection control statement which is used to take one of the two possible action.
The syntax of an if.... else statement is -
{
if(expression)
statement 1
else
statement 2
}
The expression inside the parentheses is evaluated and if it is true then statement 1 is executed and if the expression is false then statement is executed. This expression is often called the if condition. The following figure shows the flow chart for an if else statement.
Syntax
The syntax of an if.... else statement is -
{
if(expression)
statement 1
else
statement 2
}
The expression inside the parentheses is evaluated and if it is true then statement 1 is executed and if the expression is false then statement is executed. This expression is often called the if condition. The following figure shows the flow chart for an if else statement.
Syntax
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment