Shorthand numeric updates

Revision as of 14:19, 29 July 2026 by Admin (talk | contribs) (Created page with "Color 64 allows a numeric variable or numeric array element to be updated without repeating the variable name on the right side of the assignment. For example: <strong>A+12</strong> is equivalent to: <strong>A=A+12</strong> Subtraction is also supported: <strong>A-12</strong> is equivalent to: <strong>A=A-12</strong> When no expression follows the operator, Color 64 assumes a value of one: <strong>A+</strong> is equivalent to: <strong>A=A+1</strong> <strong>A-</stron...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Color 64 allows a numeric variable or numeric array element to be updated without repeating the variable name on the right side of the assignment.

For example: A+12 is equivalent to: A=A+12

Subtraction is also supported: A-12 is equivalent to: A=A-12

When no expression follows the operator, Color 64 assumes a value of one: A+ is equivalent to: A=A+1

A- is equivalent to: A=A-1

The value following the operator may be any valid numeric BASIC expression. For example:

  • A+X*2
  • A-(B+C)
  • HM+
  • N%(I)-1

Both floating-point and integer variables are supported, including array elements. String variables are not supported by this shorthand syntax.

Only the addition (+) and subtraction (-) operators should be used. Other arithmetic or logical operators are not supported in this form.

Note: Shorthand updates to integer variables use direct 16-bit arithmetic. If the result exceeds the integer range of -32768 through 32767, the value may wrap around rather than generate an overflow error.