if x else

Read(1218) Label: if statement, if, else,

Description:

The introduction of if statement.

Syntax:

if  x

 

else 

 

Note:

if and else must be in the same column. Execute if code block if x is true and execute else code block if x is false. The else part can be omitted.

Parameter:

x

A Boolean expression

Example:

 

A

B

 

1

=3

 

 

2

if A1>5

 

if code block.

3

 

>A1=A1+10

4

else

 

else code block.

5

 

>A1=A1+15

Related function:

if x …{ else { if x}… }

if x … else

if x