**Illogical Apple Logic?**

In the August 1984 issue of COMPUTE!, the ANDing and ORing of numbers was explained in the Readers' Feedback section. I tried doing some of the examples on my Apple IIe but I never got the result I expected. For instance, I POKEd the number 15 into location 7, then typed POKE 7,PEEK(7) OR 240. When I checked location 7 by typing PRINT PEEK(7), the result was 1. This also happened when I tried to AND a number. Why is this happening?

Michael Kurtz

*On most computers, the BASIC statement PRINT 240 OR 15 gives the result 255. However, Apple (and Atari) computers have a different way of doing the logical operations AND and OR.*

*Instead of doing a separate AND or OR for each bit of the two numbers, Apples do only one logical operation, treating each of the numbers as a single logical value. A number whose value is zero is considered logically* false. *Any other value is treated as* true.

*The result of an OR operation is 0 only if both of the numbers are 0. An AND operation gives a result of 1, meaning true, if neither of the numbers is 0. Apple's representation for true is also unusual. Most computers use—1 to represent a true value, but Apple has chosen to use 1.*

*None of this is important in the situation where logical operators are used the most, conditional statements such as:*

10 IF A<B AND A<C THEN PRINT "AIS BIGGEST"

*Here, the Apple behaves the same as any other computer. The difference matters only if you want to operate on individual bits of a variable or memory location.*