Logical Operations
An expression in HCL
Detect Expression Language
can contain the basic logical operations: logical and (&&)
and logical or (||) with the usual semantics. These are binary
operations that expect sub-expressions of type Bool on each side.
Shortcutting is used to evaluate the logical operations. For logical and, if
the sub-expression on the left evaluates to false, then the
sub-expression on the right is not evaluated and the result is
false. For logical or, if the sub-expression on the left
evaluates to true, then the sub-expression on the right is not
evaluated and the result is true. An expression in HCL Detect
Expression Language can also contain the not (!) operator,
which is a unary operator that expects a sub-expression of type
Bool on the right.
Examples:
- A simple logical expression:
3>5||2<4 - A logical expression that uses not:
!(3>5)