PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Use
  • Rules
  • Notes
  • Numeric variable
  • String variable
  • Priority
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Logical operators
Use
The logical operators are as follows:
  • AND
Logical multiplication. The conditions made of AND are entirely evaluated (even if the first condition is false).
  • _AND_
Logical multiplication. The conditions made of _AND_ are evaluated in an optimized way. If the first part of the expression is false, the rest of the expression is not evaluated.
  • OR
Logical addition. The conditions made of OR are entirely evaluated (even if the first condition is true).
  • _OR_
Logical addition. The conditions made of _OR_ are evaluated in optimized way. If the first part of the expression is true, the rest of the expression is not evaluated.
  • NOT
Logical negation.
The logical operators are used to perform logical operations and to build conditions.
IF Customer.City = "Montpellier" AND Customer.Title = "Mr" THEN
        ManMontpellier ++        // Number of men living in Montpellier
END
IF Customer.City = "Montpellier" OR Customer.City = "Lyon" THEN
        MontpellierLyon ++        // Number of customers living in Montpellier,
                                // or in Lyon
END
Versions 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Rules
True AND True: returns True
True AND False: returns False
True OR True: returns True
True OR False: returns True
NOT True: returns False
Notes

Numeric variable

If a numeric variable is handled like a logical operator (boolean), "0" is equivalent to False. Any other value is equivalent to True.
For example, the two following code lines are equivalent:
IF TestNum THEN...
IF TestNum <> 0 THEN...
The first syntax (IF TestNum THEN) should be preferred to the second one.

String variable

A WLanguage error will occur if a string variable is handled like a logical operator.
For example, the syntax: "IF StrTest THEN" will return an error at run time (but not when the project is compiled).

Priority

The AND and OR, _AND_ and _OR_ operators have the same priority. To give priorities to these operators, all you have to do is use brackets.
For example:
IF (A = 2 AND B &gt; 3) OR (A = 2 AND B &lt; 0) THEN...
Exceptions:
  • In the SQL files and in the SQL queries, the AND operator has priority over the OR operator.
    For example:
    Condition1 AND Condition2 OR Condition3

    will be evaluated as follows:
    (Condition1 AND Condition2) OR Condition3
  • The optimized logical addition _OR_ must not be used if one of the expressions to compare is using the result of a function that may return NULL.
    For example, the following comparison:
    IF CallFunction() = "Value1" _OR_ CallFunction() = "Value2" THEN...

    will have to be replaced by the following code if CallFunction can return the NULL value:
    IF CallFunction() = "Value1" OR CallFunction() = "Value2" THEN...
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment