Syntax
Moves the current element and every element after it into another list.
SplitList(<source>(), <destination>() [, <keep>])Parts
| <source> | The list to cut, with its parentheses. It needs a current element. |
|---|---|
| <destination> | The list that receives the moved elements, with its parentheses. Its old elements are lost. |
| <keep> | Optional, 0 by default. With a value other than 0, the current element stays in the source and only the elements after it move. |
Good to know
- Returns nothing: write it on its own line.
- Without
<keep>, the element before the cut becomes current in the source. With<keep>, the current element stays current. The destination has no current element. - When the source has no current element, nothing happens.
- The program stops when both arguments are the same list or when the types differ.
Example
NewList a.integer()NewList b.integer()FOR k = 1 TO 5 AddElement(a()) a() = kNEXTSelectElement(a(), 2)SplitList(a(), b())Console(Str(ListSize(a())) + " " + Str(a())) ' 2 2FOREACH b() Console(Str(b())) ' 3, 4, 5NEXTIn the manual : Arrays, lists and maps