Syncopation Software

DPL 9 Help

Logical Operators

Logical Operators

  • AND (&&) - the AND operator produces the number 1 if both of its operands do not equal 0. If either operand equals 0, it produces the number 0. If its first operand equals 0, it does not evaluate its second operand.
  • OR ( || ) - the OR operator produces the number 0 if both of its operands equal 0. If either operand does not equal 0, it produces the number 1. If its first operand does not equal 0, it does not evaluate its second operand.
  • NOT (!) - the NOT operator produces the number 1 if its operand equals 0 and the number 0 if its operand does not equal 0.
The AND and OR operators do not evaluate their second operand if the first operand determines the result of the operation by itself. This can be helpful if the first operand tests to see if evaluating the second operand could cause an error. The following expression is an example of this situation.

x != y && z / (x - y) <= 1 ? 0 : z

The expression equals 0 if z/(x-y) is less than or equal to 1. Otherwise it equals z. However, DPL would generate an error message if it tried to evaluate z/(x-y) when x equals y. This will never happen in the expression above. If x equals y, the first operand of the AND operator equals 0, and the operator returns 0 without evaluating its second operand.

Versions: DPL Professional, DPL Enterprise, DPL Portfolio

See Also

Operators

Logical Spreadsheet Functions