Syntax
Adds a new element before the current one and makes it the current element. The new element holds the default value of the list type.
InsertElement(<list>())Parts
| <list> | A list declared with NewList, written with its empty parentheses: scores(). |
|---|
Returns
Always 1.
Good to know
- With no current element (a new list, or after ResetList()), the new element goes in first place. After a walk that ran past the end, it goes at the end.
- After FreeList(), the call stops the program with "BASIC list is not initialized".
Example
NewList a.integer()AddElement(a())a() = 20InsertElement(a())a() = 10Console(Str(ListIndex(a())) + " " + Str(ListSize(a()))) ' 0 2FOREACH a() Console(Str(a())) ' 10, 20NEXTIn the manual : Arrays, lists and maps