FirstElement

List command

Syntax

Makes the first element of the list the current one.

FirstElement(<list>())

Parts

<list>A list declared with NewList, written with its empty parentheses: scores().

Returns

1 when the list has an element, 0 when it is empty (and then no element is current).

Good to know

  • After FreeList(), the call stops the program with "BASIC list is not initialized".

Example

NewList a.integer()Console(Str(FirstElement(a())))   ' 0FOR k = 1 TO 3  AddElement(a())  a() = k * 10NEXTIF FirstElement(a()) THEN Console(Str(a()))   ' 10
In the manual : Arrays, lists and maps