Tuto WINDEV Mobile 25
Part 4: Programming concepts 85 Examples: // Declaration of variables Cnt is int V1 is int Res is numeric // Assignment Cnt = 10 V1 = 3 // Use of operators Cnt = Cnt + 3 // Cnt is equal to 13 Cnt ++ // Cnt is equal to 14 Cnt -= 8 // Cnt is equal to 6 Cnt = Cnt * V1 // Cnt is equal to 18 Res = Cnt / 5 // Res is equal to 3.6 Comparison operators are also available: • < less than. • > greater than. • <= less than or equal to. • >= greater than or equal to. • <> different from. • = equal to. Other operators are available. See the online help for more details (keyword: "Operators"). 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).
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==