Tuto WINDEV 25
48 Part 2: The WLanguage basics Simple operations on the variables Several mathematical operators can be used to perform calculations on variables: • + to perform an addition. • - to perform a subtraction. • * to perform a multiplication. • / to perform a division. Other operators can be used to perform calculations: • ++ to increment from 1 (add 1 to the variable). • - - to decrement from 1 (subtract 1 from the variable). • += to assign by adding a value. • += to assign by subtracting a value. 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").
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==