Incr, Decr

Fast incrementation or decrementation by 1 (x = x +/- 1). This gives a speed advantage for data types byte, word, integer, long, when accessing arrays and structures. Will also work on floating values, but without a speed advantage.

Syntax

  1. Incr Variable
  2. Decr Variable

Syntax (alternative)

  1. Variable++
  2. Variable--

Info
Variable includes numeric properties in structures.

Example1:

  dim a(100) as byte
  dim b as integer
 
  incr a(4)  ' increment 5th element of Array "a" by 1
  decr a(4)  ' decrement 5th element of Array "a" by 1
  incr b     ' increment variable "b" by 1

Example2:

  ' Declare structure
  struct date
    byte hour
    byte minute
    byte second
    byte value(5)
  endstruct
  ' Dimension d as a structure
  dim d as date
 
  incr d.hour     ' increment "hour" by 1
  incr d.wert(3)  ' increment 4th element of "value" by 1
  decr d.wert(3)  ' decrement 4th element of "value" by 1