Syntax
Removes every element of a list. The list stays usable and has no current element.
ClearList(<list>())Parts
| <list> | A list declared with NewList, written with its empty parentheses: scores(). |
|---|
Good to know
- Returns nothing: write it on its own line.
- A position saved with PushListPosition() before the clear points to an element that is gone: the next PopListPosition() stops the program with "Remembered BASIC list element no longer exists".
- After FreeList(), the call stops the program with "BASIC list is not initialized".
Example
NewList a.integer()AddElement(a())AddElement(a())ClearList(a())Console(Str(ListSize(a())) + " " + Str(ListIndex(a()))) ' 0 -1AddElement(a())a() = 7Console(Str(ListSize(a()))) ' 1In the manual : Arrays, lists and maps