Logical Operators — (!, &&,
||)
! s_exp
s_exp && s_exp ...
s_exp || !s_exp ...
s_expAny Gamma or Lisp expression.
Non-nil or
nil.
In Gamma or Lisp, any expression which is not nil is
treated as being true (t)
for the purpose of boolean logic. Applying ! to any
non-nil expression will produce
nil. Applying ! to
nil must produce an arbitrary
non-nil result. The generic
non-nil value in Gamma is t.
&& evaluates each of its arguments in order,
and continues so long as each argument evaluates to
non-nil. If any argument is
nil, then nil is returned
immediately, without evaluating the rest of the arguments. If no argument is
nil, the last argument is returned.
|| returns non-nil if any of its
arguments is not nil. Each argument is evaluated in
turn, and as soon as a non-nil value is reached, that
argument is returned. Subsequent arguments are not evaluated.
Gamma>6;6Gamma>!6;nilGamma>!nil;tGamma>5<6 && string("hi ","there");"hi there"Gamma>5>6 && string("hi ","there");nilGamma>x = 5;5Gamma>y = 6;6Gamma>(x = t) || (y = 0);tGamma>x;tGamma>y;6Gamma>