Syntax
Moves the cursor to the previous element and makes it current.
PreviousElement(<list>())Parts
| <list> | A list declared with NewList, written with its empty parentheses: scores(). |
|---|
Returns
1 when it moved, 0 when there was no previous element.
Good to know
- Before the first element it returns 0 and leaves no current element. It does not wrap around to the last one.
- After a NextElement() that ran past the end, it goes back to the last element.
- After FreeList(), the call stops the program with "BASIC list is not initialized".
Example
NewList a.integer()FOR k = 1 TO 3 AddElement(a()) a() = kNEXTLastElement(a())REPEAT Console(Str(a())) ' 3, 2, 1UNTIL PreviousElement(a()) = 0In the manual : Arrays, lists and maps