Search                        Top                                  Index
HELP AND                                       J. L. Cunningham Jul 1982
                                         Updated: Adrian Howard Mar 1992

The infix operator -and- is used to form a "conjunction" of two
expressions. For example:

    <P> and <Q>

This expression will return the value of the expression <Q> if both <P>
and <Q> evaluate to non-false values. If either <P> or <Q> is -false-,
then -false- is returned.

The expression <P> is evaluated first. If <P> is -false- then the whole
expression evaluates to -false- immediately and <Q> is not evaluated. If
<P> is not -false- then <Q> is evaluated. If <Q> is not -false- as well,
then -true- is return. This is known as "lazy" evaluation --- only the
expressions that need to be evaluated are evaluated.

Normally -and- will be used with *BOOLEAN expressions, when it can be
treated like a logical "and" operation. Some programming languages
require the value of expressions used in conditions, e.g. after the
syntax word *IF, to be boolean, but POP does not --- it treats any value
which isn't -false- as true.

There is also a bitwise logical 'and' operator (&&) on integers treated
as a sequences of "bits", see REF *NUMBERS/Bitwise for details.

Also see:

    HELP *OR            --- Forming disjunctions in POP-11
    HELP *BOOLEAN       --- Boolean expressions and values
    HELP *CONDITIONALS  --- Summary of POP-11 conditional statements

    REF *RECORDS/Booleans --- Full information on "booleans"

--- C.all/help/and
--- Copyright University of Sussex 1992. All rights reserved. ----------