If...Then...Else...Endif

Program flow management function.

The If...EndIf structure defines a conditional statement.

Usage

It allows decisions to be made during the execution of the script depending on the result of a condition (true or false). If the result is True, WinTask executes the block of steps following the If line up until an EndIf is encountered, otherwise the block is skipped (if an Else line is encountered, the Else block is executed).

Syntax

If <boolean_expression> Then
  <statements>
[Else
  <statements>]
EndIf

Parameters

<boolean_expression>, if the expression evaluates to TRUE, the <statements> after the THEN are executed; if the expression evaluates to FALSE, the <statements> after the ELSE are executed. The ELSE statement is optional.

See also

Logical operators

Example

 

If a=1 Then

  beep(100)

Else

  beep(200)

EndIf

 

If b=3 Then

  beep(100)

EndIf