Tuto WINDEV 25

58 Part 2: The WLanguage basics 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 Remark Several functions and properties are available in WLanguage. The functions can accept parameters and they return results. The properties are directly applied to the controls or variables via the following syntax: <Name of control or variable>..<Property name> In our example, ..Day is used on the D variable to get the day of the date. The online help of a function or property can be displayed at any time by pressing F1. See "How to access the online help ?" for more details.

RkJQdWJsaXNoZXIy NDQ0OA==