FANDOM


Syntax

AGET array number or list

Explanation

AGET outputs the value in a specific location of an array as specified by its inputs. The first element of its input is the array to be accessed, while the second element describes the array element to be obtained. For one-dimensional arrays, the second element may be a number starting from 0; for multi-dimensional arrays, the input element is a list of numbers, where each number stands for one dimension. Bytearrays always output numbers between 0 and 255, while arrays output the value stored in the accessed element. If no value is stored, bytearrays output 0 while arrays output an empty list [].

Examples

? MAKE "A ARRAY [2 2]

? AGET :A [1 0]

Result: []

? ASET :A [1 1] [SQUARE 4]

? AGET :A [1 1]

Result: [SQUARE 4]

? MAKE "B BYTEARRAY [2 2]

? AGET :B [1 0]

Result: 0

? ASET :B [1 1] 10

? AGET :B [1 1]

Result: 10

?

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.