Skip to content

If

The syntax for an if statement is:

If   {Boolean-expression}  {true-statement}
Else {false-statement}

Where:

  • {Boolean-expression}: An expression that will return a True or False value.
  • {true-statement}: The statement that will execute if True is returned by the Boolean expression.
  • {false-statement}: The statement that will execute if False is returned by the Boolean expression.

The else part of the if statement is optional. If it is not present, execution will continue at the next statement in the program when the Boolean expression is False (without executing the {true-statement}).

Examples

If (iCount > 10) Move ("greater than 10") To sMessage
Else  Move ("less or equal to 10") To sMessage

If ((iValue - 1) < 1000) Begin
    Move (iValue)     To Sales.Small
    Move ("sub 1000") To Sales.Note
End
Else Begin
    Move (iValue)      To Sales.Large
    Move ("over 1000") To Sales.Note
End

If (bSmoking) Move ("Somebody stop me!") To sMessage