SelectElement()
Syntax
SelectElement(LinkedList(), Position)Description
Change the current list element to the element at the specified position. The first list element is at position 0, the next at position 1 and so on. This is very useful if you want to jump to a specific position in the list without using an own loop for this.
As linked lists don't use an index, it will jump compulsory to every element until the target position is reached. If a faster method is needed, ChangeCurrentElement() should be used.
Parameter:
linkedlist() - The name of your linked list variable, created with the NewList command. You must specify the brackets after the list name.
Position - The position to move to in the list, considering that the first item in the list is at position 0, the next is at 1 and so on. You must make sure that you do not specify a position that is outside of the number of elements in the list!
Return value:
This command does not return any value.
Example:NewList mylist.l() AddElement(mylist()) : mylist() = 23 AddElement(mylist()) : mylist() = 56 AddElement(mylist()) : mylist() = 12 AddElement(mylist()) : mylist() = 73 SelectElement(mylist(), 0) MessageRequester("Position", "At position 0, the value is "+Str(mylist()),0) SelectElement(mylist(), 2) MessageRequester("Position", "At position 2, the value is "+Str(mylist()),0) SelectElement(mylist(), 1) MessageRequester("Position", "At position 1, the value is "+Str(mylist()),0) SelectElement(mylist(), 3) MessageRequester("Position", "At position 3, the value is "+Str(mylist()),0)
Supported OS
All