if x …else …

Read(1013) Label: if statement, same line,

Description:

The introduction of if statement.

Syntax:

if  x   else

Note:

if and else are in the same line. If x is true, then execute the code between if and else; if x is false, execute the code after else till the end of this line. The else… part can be omitted.

Parameter:

x

A boolean expression

Example:

 

A

B

C

D

 

1

=2

 

 

 

A1 returns 7.

2

if A1>5

>A1=A1+4

else

>A1=A1+5

 

Related functions:

if x …{ else { if x}… }

if x else

if x