DADiSP Worksheet Functions > A - E > END

 

END

Purpose:

Returns the last index of an array or array row or column.

Syntax:

A[end]

A[end, end]

Returns:

An integer, the last array index or last array row or column index.

Example:

a = 1..100

b = a[end]

 

b == 100

Example:

a1 = ravel(1..12, 4);

b1 = a[end];

b2 = a[1, end];

b3 = a[end, 1];

b4 = a[end, end];

b5 = a[end-1, end-1];

 

a1 == {{1, 5, 9},

{2, 6, 10}, 

{3, 7, 11}, 

{4, 8, 12}} 

 

b1 == a1[12] == 12

b2 == a1[1, 3] == 9

b3 == a1[4, 1] == 4

b4 == a1[4, 3] == 12

b5 == a1[3, 2] == 7

Example:

a = ravel(1..12, 4);

b = 1..2;

c = a[b[end], end];

 

c == a[2, 3] == 10

Remarks:

END can only be used inside an array reference expression, i.e. an array name followed by [ ].

 

See STARTINDEX to set the starting index for array operations in an SPL function.

See Also:

EXTRACT

STARTINDEX