DeleteElement()

Syntax

DeleteElement(LinkedList() [, Flags])
Description
Remove the current element from the list. After this call, the new current element is the previous element (the one before the deleted element). If that element does not exist (in other words, you deleted the first element in the list) then there is no more current element, as it will be before the first element, like after a ResetList().

Parameters

LinkedList() LinkedList() - The name of your linked-list variable, created with the NewList function. You must include the brackets after the list name.
Flags (optional) If this parameter is set to 1 and the first element is deleted, the new current element will be the second one. This flag ensure than there will be always a valid current element after a delete as long as there are still elements in the list.

Return value

This function has no return value.

Example

  NewList people.s()

  AddElement(people()) : people() = "Tom"
  AddElement(people()) : people() = "Dick"
  AddElement(people()) : people() = "Harry"
  AddElement(people()) : people() = "Bob"

  FirstElement(people())
  DeleteElement(people(), 1)
  MessageRequester("Information", "First person in list is "+people(), #PB_MessageRequester_Ok)

  LastElement(people())      ; Moves to "Bob"
  PreviousElement(people())  ; Moves to "Harry"
  DeleteElement(people())    ; And deletes him. there is an element before Harry, so it becomes the current
  MessageRequester("Information", "Current person in list is "+people(), #PB_MessageRequester_Ok)

See Also

AddElement(), InsertElement(), ClearList()

Supported OS

All

<- CountList() - LinkedList Index - FirstElement() ->