|
|
|
|
|
- Use
- Using the default optimized mode
- Rules
- Notes
- Numeric variable
- String variable
- Priority
The logical operators are as follows: | | | Logical multiplication. The conditions made of AND are entirely evaluated (even if the first condition is false). | | 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. | | Logical addition. The conditions made of OR are entirely evaluated (even if the first condition is true). | | 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. | | Logical negation. | | Corresponds to the combination of OR and '=' operators. DANS compares an element with a list of expressions. All the expressions found in the list are evaluated. For more details, see IF statement. | | Corresponds to the combination of OR and '=' operators. _DANS_ performs an optimized comparison of an element with a list of expressions. The expressions in the list are evaluated from left to right. Once an expression has met the condition, the rest of the expressions are not evaluated.. For more details, see IF statement. |
The logical operators are used to perform logical operations and to build conditions. IF Client.Ville = "Montpellier" AND Client.Civilité = "Monsieur" THEN
HommeMontpellier ++
END
IF Client.Ville = "Montpellier" OR Client.Ville = "Lyon" THEN
MontpellierLyon ++
END
Using the default optimized mode From version 2024 onwards, it is possible to use the optimized mode of the AND, OR and IN operators by default (without using the _ET_, _OR_ and _IN_ syntax).. To do this, simply activate the "Optimización: evaluación optimizada de expresiones booleanas (AND, OR, IN)" option in the "Compilation" tab of the project description window (see Project description: Compilation tab). Note: This option is automatically activated in all new projects created from version 2024 onwards.. True AND True: returns True (idem _ET_) True AND False: returns False(idem _ET_) True OR True: returns True(idem _OU_) True OR False: returns True(idem _OU_) PAS True: returns False 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 lines of code are equivalent: 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 ChTest THEN" will return an error at runtime (but not at compile time). 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: SI (A = 2 ET B > 3) OU (A = 2 ET B < 0) ALORS ... Exceptions: - In SQL filters and queries, the AND operator takes precedence over the OR operator.
For example:
Condition1 ET Condition2 OU Condition3 will be evaluated as follows:
(Condition1 ET Condition2) OU Condition3 - The optimized logical addition _OR_ must not be used if one of the expressions to compare uses the result of a function that may return NULL.
For example, the following comparison:
SI AppelFonction() = "Valeur1" _OU_ AppelFonction() = "Valeur2" ALORS... will have to be replaced with the following code if CallFunction can return the NULL value:
SI AppelFonction() = "Valeur1" OU AppelFonction() = "Valeur2" ALORS...
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|