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(). But, if the parameter 'Flags' 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. If there was only one element in the list when you deleted it then you are left with no current element!

Parameters:
linkedlist() - The name of your linked list variable, created with the NewList command. You must specify the brackets after the list name.

Return value:
This command does not return any 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())
  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)

Supported OS

All

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