Logical operations

General
Comparison operations
Boolean operations

A logical operation compares operands and creates a Boolean value: True or False. There are two types of logical operations: comparison operations and Boolean operations. Comparison operations compare two values. Boolean operations are performed on Boolean values, implementing Boolean algebra. You can combine Boolean operation symbols to create compound operations.

Comparison operations

The following comparison operations are defined in 1C:Enterprise script:

More:

(Op1 > Op2)

More or equal:

(Op1 >= Op2)

Less:

(Op1 < Op2)

Less or equal:

(Op1 <= Op2)

Equal:

(Op1 = Op2)

Not equal:

(Op1 <> Op2)

Comparison operations are defined for the following operand types:

More:

Number>Number
String>String
Date>Date

More or equal:

Number>=Number
String>=String
Date>=Date

Less:

Number<Number
String<String
Date<Date

Less or equal:

Number<=Number
String<=String
Date<=Date

Equal:

Any type=Any type

Not equal:

Any type<>Any type

Boolean operations

The following types of Boolean operations are defined in 1C:Enterprise script:

   AND

Conjunction (Boolean AND)

   OR

Disjunction (Boolean OR)

   NOT

Logical negation (Boolean negation NOT)

Logical expressions are calculated from left to right. To avoid ambiguity and specify the exact order of operator execution, use parentheses ( ).

Logical operation priority levels

Level 1. Operands in parentheses
Level 2. NOT
Level 3. AND
Level 4. OR

Note. When a logical expression is calculated, only the required parts of the expression are calculated. For example, for the expression (Price > 0) AND CheckSum(), if Price <= 0, the CheckSum() function is not called.


     

1C:Enterprise Developer's Community