Logical operations

Mathmate supports the following logical operations: less than (<), greater than (>), equals (=), not (!), and (&), or (|). The operation signs may not follow each other. If x <= y is needed, use !(x > y).

A logical expression is evaluated as 1 if it is true and as 0 if it is false.

The user is encouraged to always use brackets to ensure correct precedence and correct priority with respect to arithmetical operations. In general, arithmetical operations are assigned lower priority than the logical ones.

Examples:

  1. 2 + 1 < 2 is interpreted as (1 + 2) < 2 (= 0), and not as 2 + (1 < 2) (= 3).
  2. 1 < 2 < 3 is evaluated as (1 < 2) < 3 = 1 < 3 = 1. At the same time 3 > 2 > 1 is evaluated as (3 > 2) > 1 = 1 > 1 = 0.