next up previous contents index
Next: Assignment Expressions Up: Expressions Previous: Relational Expressions

Logical Expressions

    The binary | and & perform boolean ``or" and ``and" respectively. They require boolean operands and yield boolean results. They work in the usual fashion with equal-sized vector operands or one vector and one scalar. See § 3.2.4, page gif.


    In addition to | and &, Glish provides the related ||  and &&  operators, taken from C. These are ``short-circuit" operators; they evaluate their right-hand operand only when needed. Unlike most of the other operands, these do not   perform element-by-element vector operations. Both operands should be numeric scalars, though presently vector values are allowed, in which case the first element of the vector is used.

The || operator evaluates its first operand and returns it if true when considered as a boolean. Otherwise it evaluates and returns its second operand. The && operator returns F if its first operand evaluates to false, otherwise it evaluates and returns its second operand.

Thu Nov 13 16:44:05 EST 1997