NewList
DescriptionNewList name.<type>()
NewList allows to declare a new dynamic list. Each element of the list is allocated dynamically. There are no element limits, so there can be as many as needed. A list can have any Variables standard or structured type. To view all commands used to manage lists, see the List library.
The new list are always locals, which means Global or Shared commands have to be used if a list declared in the main source need to be used in procedures. It is also possible to pass a list as parameter to a procedure by using the keyword List.
For fast swapping of list contents the Swap keyword is available.
Example: Simple list
NewList MyList() AddElement(MyList()) MyList() = 10 AddElement(MyList()) MyList() = 20 AddElement(MyList()) MyList() = 30 ForEach MyList() Debug MyList() Next
Example: List as procedure parameter
NewList Test() AddElement(Test()) Test() = 1 AddElement(Test()) Test() = 2 Procedure DebugList(c, List ParameterList()) AddElement(ParameterList()) ParameterList() = 3 ForEach ParameterList() MessageRequester("List", Str(ParameterList())) Next EndProcedure DebugList(10, Test())