Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Remove misplaced comment explanation

Arrays are created by enclosing comma-delimited expressions in square brackets like so:

Code Block
languagejavascript
themeConfluence
["a", "b", "c"]


Arrays use zero-base indexing and can be referenced in the usual manner:

Code Block
languagejavascript
themeConfluence
a = [1,4,3,6,5];

...


b = a[1] // b =

...

 4


Note that array references only work for arrays of one any dimension. For example, c[1][2] is not allowed (presuming c is an array of arrays). Multidimensional arrays can be dereferenced using the pick operator (described momentarily).

Operations on Arrays

There are a number of operators that work on arrays. In addition there is an array membership infix operator