Skip to main content
Untitled Document

Arrays

Arrays

Arrays

JAL allows one dimensional arrays of any non-bit type. These are defined during variable definition using the notation:

          VAR type '[' cexpr ']' id

This defines id as type with cexpr elements. These are accessed using brackets. The elements are numbered from zero, so for 5 elements the accessors are 0 to 4.

Example:

          VAR BYTE stuff[5], xx

          xx = 2
          stuff[0] = 1
          stuff[xx] = 2
          xx = stuff[xx]
Note: There is no error checking when an array is accessed with a variable. In the above example, if xx is 5 no error will be generated, but the results will not be as expected.