[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

DESCRIPTION OF BASIC KEYWORDS

ABS

TYPE: Function-Numeric
FORMAT: ABS(<expression>)

Action: Returns the absolute value of the number, which is its value without any signs. The absolute value of a negative number is that number multiplied by -1.

EXAMPLES of ABS Function:
   10 X = ABS (Y)
   10 PRINT ABS (X*J)
   10 IF X = ABS (X) THEN PRINT"POSITIVE"

AND

TYPE: Operator
FORMAT: <expression> AND <expression>

Action: AND is used in Boolean operations to test bits. it is also used in operations to check the truth of both operands. In Boolean algebra, the result of an AND operation is 1 only if both numbers being ANDed are 1. The result is 0 if either or both is 0 (false).

EXAMPLES of 1-Bit AND operation:
           0         1         0         1
       AND 0     AND 0     AND 1     AND 1
      ------     -----     -----     -----
           0         0         0         1

The Commodore 64 performs the AND operation on numbers in the range from -32768 to +32767. Any fractional values are not used, and numbers beyond the range will cause an ?ILLEGAL QUANTITY error message. When


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated November 14, 1998.