[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
and                      Logical and Integer Operator AND            Operator

 <bool exp> and <bool exp>   { does a logical AND; result is Boolean }
 <int exp>  and <int exp>    { does a bitwise AND; result is Integer }

    The operator AND can be used for both boolean and integer expressions.
    For boolean expressions, it uses the left truth table below:

  +------------------------------------------------------------------------+
  | <exp1>  <exp2> | <exp1> and <exp2>   <bit1> <bit2> | <bit1> and <bit2> |
  |----------------+-----------------------------------+-------------------|
  | FALSE   FALSE  |       FALSE           0      0    |         0         |
  | FALSE   TRUE   |       FALSE           0      1    |         0         |
  | TRUE    FALSE  |       FALSE           1      0    |         0         |
  | TRUE    TRUE   |       TRUE            1      1    |         1         |
  +------------------------------------------------------------------------+

    For integer expressions, it does a bit-by-bit combination of the two
    integer values, using the right truth table above. The result is a
    sixteen-bit integer value.

      <bool exp>    any combination of Boolean values and operators.

      <int expr>    any combination of Integer values and operators.

  -------------------------------- Example ---------------------------------

           while (Indx <= Size) and not Found do begin
             Indx := Indx + 1;
             Found := IsLocated (Indx);
           end;

           I := $4123 and $0F00;    { I = $0100 }

See Also: or xor not
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson