PreviousElement()
Syntax
Result = PreviousElement(linkedlist())Description
Change the current list element with the previous element and return its address or return 0 if the current element is the first element or if no elements are in the list..
Parameter:
linkedlist() - The name of your linked list variable, created with the NewList command. You must specify the brackets after the list name.
Return value:
The value returned by this command can be used to show whether the previous element exists or not (it will not exist if you are at the start of the list). If the previous item exists, this command will return a value which is not equal to zero. If the previous element does not exist then it will return a value of zero.
Advanced users only:
The value that this command returns is a pointer to the previous element or zero if the previous element does not exist. The structure of each element is shown below:Structure Element *Next.Element ; Pointer to next element in list or zero if at last element *Previous.Element ; Pointer to previous element in list or zero if at first element ; The users data type which the list was created with will follow ; those two variables (which means the user data can be found at ; the address of the new element + 8 EndStructureYou should not change the pointers at the start of the elements as this will break the structure of the list, leading to all sorts of problems.
Example:NewList numbers.w() For i=1 To 10 AddElement(numbers()) numbers() = i Next Repeat MessageRequester("Number", Str(numbers()), #PB_MessageRequester_OK) Until PreviousElement(numbers()) = 0
Supported OS
All