Skip to content
Cameron Purdy edited this page Apr 7, 2020 · 3 revisions

The logical “or” expression is a well-known expression form:

a || b

Additionally, an exclusive-or (xor) expression with the ^^ operator shares the same operator precedence level:

a ^^ b

The type of the expressions a and b must both be Boolean. The implicit type of the expression is Boolean.

For the || operator: If the expression a yields True, then the expression yields True, and the expression for b is not evaluated[1]. Otherwise, if the expression a yields False, then the expression yields the result of the expression b.

For the ^^ operator: Both the expression a and b are evaluated. If the two yielded values are the same, then the expression yields False; otherwise the expression yields True.

The expression short-circuits if either expression a or b short-circuits.

Definite assignment rules for the || operator:

  • The VAS before a is the VAS before the expression.
  • The VAS before b is the VASF after a.
  • The VAS after the expression is the join of the VAST after a and the VAS after b.
  • The VAST after the expression is the join of the VAST after a and the VAST after b.
  • The VASF after the expression is the VASF after b.

Definite assignment rules for the ^^ operator:

  • The VAS before a is the VAS before the expression.
  • The VAS before b is the VAS after a.
  • The VAS after the expression is the VAS after b.

The OrExpression groups to the left, so a || b || c is treated as (a || b) || c.

    OrExpression:
        AndExpression
        OrExpression || AndExpression
        OrExpression ^^ AndExpression

[1]

This is often referred to as "short-circuit logic", but that term is not used here, in order to avoid confusion with the Ecstasy concept of short-circuiting expressions.