IF...THEN...ELSE...END IF

Concept Link IconSee also

Conditional execution of instructions according to the result of a logical expression.

WebVue support - Yes.

Mnemonic

Syntax

IF...THEN... 1
IF...THEN...ELSE...END IF 2

Syntax 1

IF (Condition) THEN

  [instruction block 1]

END IF

There is no return type.

Argument

Meaning

Condition

A logical expression, for example: TankLevel > 25.

Execution

If the condition is true then instruction block 1 is executed after which the program continues at the line after the END IF.

Syntax 2

IF (Condition) THEN

    [instruction block 1]

ELSE

    [instruction block 2]

END IF

There is no return type.

Execution

If the condition is true then instruction block 1 is executed else instruction block 2 is executed after which the program continues at the line after the END IF.

Example

SUB Main()

DIM i as Integer;

 

i=0;

'or: i=1;

If (i==1)Then

  Print("i=1");

Else

  Print("i is not 1");

End If

END SUB