%Length

This special method returns the length of an array object or element. Array indices start at 0 and end at %Length()-1.

Use of %Length on anything other than an array results in a thrown exception.

All special method names and keywords are case-insensitive.

Syntax

object->%Length()

Syntax elements

objectAn expression that evaluates to an internal array object or element.

Applicability

Internal objects only. Java and .NET provide property fields for determining the length of arrays.

Example

Gets the length of an array object

NaturalNos = %Array(int, 1, 2, 3, 4, 5, 6)
PRINT NaturalNos->%Length()

which produces:

6

See also

%Array