Announcement

Collapse
No announcement yet.

And Operator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • And Operator

    Please add your comments and suggestions as a Reply to this thread.





    PB/WIN - AND operator

    Purpose
    The AND operator works as both a logical and a bitwise arithmetic operator.
    Syntax
    p AND q
    Using AND as a logical operator
    AND returns TRUE (non-zero) if (and only if) both its operands are TRUE. The AND truth table looks like this:


    AND Truth Table

    Code:
    +-----------------+
    | x | y | x AND y |
    +-----------------+
    | T | T | T       |
    +-----------------+
    | T | F | F       |
    +-----------------+
    | F | T | F       |
    +-----------------+
    | F | F | F       |
    +-----------------+
    Using AND as a bitwise arithmetic operator
    AND masks clear selected bits of an integral-class value without affecting the other bits. For example, to clear the most-significant (leftmost) 2 bits in the integer value &H9700, AND it with &H3FFF. That is, the mask contains all 1s, except for the bit positions you want to force to 0:



    See Also
    Last edited by Gary Beene; 28 Oct 2014, 06:39 PM.
Working...
X