aref

aref — returns an array expression at a given index.

Syntax

aref (array, index)

		

Arguments

array

An array.

index

A number giving the index into the array, starting at zero.

Returns

The array element at the given index in the array.

Description

The index starts at zero, and extends to the length of the array minus one. If the index is not valid in the array, nil is returned, but no error is generated.

[Note]

Note: This function is identical to the square bracket syntax for referencing array elements, with the syntax:

array[index]

Example

Gamma> x = array (1, 5, #d, "farm");
[1 5 d "farm"]
Gamma> aref (x, 0);
1
Gamma> aref (x, 8);
nil
Gamma> x[3];
"farm"
Gamma> 
		

See Also

array, aset, delete, insert, sort