The same word,
AND, is also used for logical and. But the two input values to
AND are recommended to be well-formed flags; true and false are represented by two values, bits all set (-1) and bits all unset (0). Other values than these may work as true (as in C), but it may lead to subtle errors.
All comparison operators return well-formed flags, but for instance
- does not. The following evaluates to false (0).
7 5 - 7 3 - AND
AND gets bit patterns 100 and 010. The result is 0 (as it does the bitwise and).
- Bit Manipulations in Forth, part of Learning Forth Bit by Bit.
- Section "A Little Logic" in Chapter 4 of Starting Forth.