& and [tex2html_wrap2912]



next up previous contents index
Next: Precedence and Associativity Up: Expressions Previous: Fetch

& and [tex2html_wrap2912]

Two special ``short-circuit'' binary Boolean operators are provided, "&" and "|".

expr[tex2html_wrap2914] "&" expr[tex2html_wrap2916]
is the boolean _and_ of _expr_[tex2html_wrap2918] and _expr_[tex2html_wrap2920] except that _expr_[tex2html_wrap2922] is guaranteed to be evaluated before any part of _expr_[tex2html_wrap2924]. If _expr_[tex2html_wrap2926] is "false", _expr_[tex2html_wrap2928] is not evaluated. Similarly, "|" is the same as a boolean or except that expr[tex2html_wrap2930] is not evaluated if expr[tex2html_wrap2932] evaluates to "true". For both "&" and "|", the two expressions must have type "bool" and the result is a "bool".

Because of the conditional expression evaluation, uses of "&" and "|" are not equivalent to any normal invocation.



theta-questions@lcs.mit.edu