|
|
Nested if..else
Nested if else statements can be useful to check multiple conditions. For example, given a number first check whether it is positive or negative then test the range in the respective domains.
Syntax:
if condition
then
if condition
then
statement1
else
statement2
fi
else
statement3
fi
Example :
if..elif statements
Syntax
if condition1
then
statement1
elif condition2
then
statement2
elfi condition3
then
statement3
else
#if none of the conditions are satisfied
statement4
fi
No comments:
Post a Comment