The SWITCH statement
This statement is used to evaluate an expression and to run a process for each possible expression value.
The SWITCH statement can be used as follows:
SWITCH <Expression>
CASE Value 1:
Process 1...
CASE Value 2:
Process 2...
...
CASE Value N:
Process N...
OTHER CASE
Process ...
END
WLanguage code example: The following code retrieves today's date and displays a different message according to its value. A specific message is displayed for the 1st and for the 15th of the month. In the other cases, today's date is displayed.
D is Date
D = Today()
SWITCH D..Day // Checks the day of the date
CASE 1: Info("We are the first day of the month")
CASE 15: Info("We are the 15th of the month")
OTHER CASE: Info("We are the: " + DateToString(D))
END