SwapElements()
Syntax
SwapElements(LinkedList(), *FirstElement, *SecondElement)Description
Swaps the position of two elements in the specified list. This command is a fast way to reorganize a list, because it does not actually move the element data itself.
Parameters
LinkedList() The name of your linked-list variable, created with the NewList function. You must include the brackets after the list name. *FirstElement Address of the first element to swap. You can get this address by using the @ operator on the list name. *SecondElement Address of the second element to swap. You can get this address by using the @ operator on the list name.
Return value
This function has no return value.
Example
NewList Numbers() For k=0 To 10 AddElement(Numbers()) Numbers() = k Next SelectElement(Numbers(), 3) ; Get the 4th element (first element is 0) *FirstElement = @Numbers() SelectElement(Numbers(), 9) ; Get the 10th element *SecondElement = @Numbers() ; Swap the 3 with the 9 ; SwapElements(Numbers(), *FirstElement, *SecondElement) ; Prove it ; ForEach Numbers() Debug Numbers() Next
See Also
MoveElement()
Supported OS
All