MoveElement(LinkedList(), Location [, *RelativeElement])
Moves the current element of the specified list to a different position in the list. The moved element remains the current element of the list. This is a fast operation because the element data itself is not moved to change the location in the list.


LinkedList() The name of your linked-list variable, created with the NewList function. You must include the brackets after the list name.
Location Location where to move the current element. This can be one of the following values:
  #PB_List_First : Move the element to the beginning of the list
  #PB_List_Last  : Move the element to the end of the list
  #PB_List_Before: Move the element before the *RelativeElement
  #PB_List_After : Move the element after the *RelativeElement
*RelativeElement (optional) The address of another element in relation to which the current element should be moved. This parameter is required when the 'Location' parameter is #PB_List_Before or #PB_List_After. You can get this address from an element by using the @ operator on the list name.

Return value

This function has no return value.


  NewList Numbers()
  For k=0 To 10
    Numbers() = k
  SelectElement(Numbers(), 5) 
  *Relative = @Numbers()                             ; get address of element 5
  SelectElement(Numbers(), 0)
  MoveElement(Numbers(), #PB_List_After, *Relative)  ; move after element 5
  SelectElement(Numbers(), 10)
  MoveElement(Numbers(), #PB_List_First)             ; move to the beginning
  ; Result
  ForEach Numbers()
    Debug Numbers()

See Also


Supported OS


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