CSC209 Lecture Slide 3
CSC209 Lecture Slide 3
FACULTY OF COMPUTING
value of a is : 10
If … Else Statement
An if statement can be followed by an optional else statement, which
executes when the Boolean expression is false. It’s syntax is given
below:
if(boolean_expression)
{
/* statement(s) will execute if the boolean expression is true */
}
else
{
/* statement(s) will execute if the boolean expression is false */
}
Value of a : 10
Value of a : 11
Value of a : 12
Value of a : 13
Value of a : 14
Value of a : 15
Value of a : 16
Value of a : 17
Value of a : 18
Value of a : 19
Value of a : 10
Value of a : 11
Value of a : 12
Value of a : 13
Value of a : 14
Value of a : 15
Value of a : 16
Value of a : 17
Value of a : 18
Value of a : 19