1.

Explain If…else statements.

Answer»

If…else statements

An else statement can be combined with an if statement. An else statement contains the block of code that executes if the conditional expression in the if statement resolves to 0 or a false value.

The else statement is an optional statement and there could be at most only one else statement following if

Syntax:

The syntax of the if…else statement is :

if expression :

statement(s)

else:

statement(s)



Discussion

No Comment Found