FreeList

List command

Syntax

Removes every element of a list and frees the list. It cannot be used again until a new NewList declares it.

FreeList(<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.
  • After FreeList(), ListSize() and ListIndex() return -1. Every other list call stops the program with "BASIC list is not initialized".
  • Calling FreeList() twice on the same list is harmless.
  • To empty a list and keep using it, use ClearList().

Example

NewList a.integer()AddElement(a())FreeList(a())Console(Str(ListSize(a())))   ' -1NewList a.integer()Console(Str(ListSize(a())))   ' 0
In the manual : Arrays, lists and maps