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 function. You must include the brackets after the list name.

Return value:
The value returned by this function 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 function 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 function returns is a pointer to the previous element data or zero if the previous element does not exist.

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

<- NextElement() - LinkedList Index - ResetList() ->