User Tools

Site Tools


ugbasic:user:kw:array
Translations of this page:


ugBASIC User Manual

array

SYNTAX

   ... = [variable]([index1]{, [index2] {, ...}})
   [variable]([index1]{, [index2] {, ...}}) = ...

PURPOSE

In ugBASIC, arrays are accessed using the parenthesis operator (( and )) next to the name of the variable that contains the array. The indices must be inserted inside the brackets to access the individual elements of the array.

There is no limit to the number of dimensions: however, the cardinality of indices must be the same as the one used when defining the array itself. There is, also, a limit related to memory availability. Furthermore, access to locations is not controlled and therefore particular care must be taken not to exceed the boundaries of the area intended to hold the information on the array.

When an array is accessed, it can be done in two ways: to retrieve a value (read access) or to set a value (write access). Read access occurs any time the array is used in an expression. Conversely, for write access, the indexed array must be used as the target variable.

EXAMPLE

  readElement = a(42,3)
  b(1,1) = 42

AVAILABLE ON

  • Commodore 64
  • ZX Spectrum 48K
  • Commodore PLUS/4
  • Atari (400/800/XL)
  • Dragon 32
  • Dragon 64
  • PC128 Olivetti Prodest
  • Commodore VIC-20

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY