Syntax
Makes the last element of the list the current one.
LastElement(<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
- An AddElement() right after it appends at the end of the list.
- After FreeList(), the call stops the program with "BASIC list is not initialized".
Example
NewList a.integer()FOR k = 1 TO 3 AddElement(a()) a() = k * 10NEXTIF LastElement(a()) THEN Console(Str(a()) + " at " + Str(ListIndex(a()))) ' 30 at 2In the manual : Arrays, lists and maps