Logical Operators

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


4th Dimension supports two logical operators that work on Boolean expressions: conjunction (AND) and inclusive disjunction (OR). A logical AND returns TRUE if both expressions are TRUE. A logical OR returns TRUE if at least one of the expressions is TRUE.

4th Dimension also provides the Boolean functions True, False, and Not. For more information, see the descriptions of these commands.

The following table shows the logical operators:

OperationSyntaxReturnsExpressionValue
ANDBoolean & BooleanBoolean("A" = "A") & (15 # 3)True
("A" = "B") & (15 # 3)False
("A" = "B") & (15 = 3)False
ORBoolean | BooleanBoolean("A" = "A") | (15 # 3)True
("A" = "B") | (15 # 3)True
("A" = "B") | (15 = 3)False

The following is the truth table for the AND logical operator:

Expr1Expr2Expr1 & Expr2
TrueTrueTrue
TrueFalseFalse
FalseTrueFalse
FalseFalseFalse

The following is the truth table for the OR logical operator:

Expr1Expr2Expr1 | Expr2
TrueTrueTrue
TrueFalseTrue
FalseTrueTrue
FalseFalseFalse

Tip

If you need to calculate the exclusive disjunction between Expr1 and Expr2, evaluate:

   (Expr1 | Expr2) & Not(Expr1 & Expr2)

See Also

Bitwise Operators, Comparison Operators, Date Operators, Numeric Operators, Operators, Picture Operators, String Operators, Time Operators.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next