Tuto WINDEV 25

Part 2: The WLanguage basics 49 Tips • It is very convenient to name the variables with long names (and to avoid short names such as i, j, k, ...). When reading the program again, you will be able to easily remember the variable purpose. • To define the name of variables, all Unicode characters (including the accented characters) are accepted. Meaning improved readability! Caution: some characters are not allowed: space, =, dot, comma, ... • It is very important to give the proper type to the variable according to its use. For example, to store several digits, you may have to: • use a numeric variable if this variable must be used for calculations. • use a string variable if this variable must be used to store digits without performing calculations (to store the social security number for example). Details of variable type: the String variables The String variables are the most often used types of variables. Let’s present in details some features available for this type of variable. The String type The String type is used to store and handle characters and character strings. We have already seen how to initialize a string variable: LastName is string // Assign a string variable LastName = "Doe" There is no need to declare the string length: this length automatically adapts when using the variable. Tip To initialize a string variable with a text on several lines, use the following syntax: <Variable name> = [ <Text of line 1> <Text of line 2> ] For example: MyString is string MyString = [ Example of multi-line string ]

RkJQdWJsaXNoZXIy NDQ0OA==