Sfairadora

  • Reference Guide

remove_element

remove_element(seq, pos)
remove_element(seq, pos, var_elem)
var_seq <- remove_element(pos)
var_seq <- remove_element(pos, var_elem)
Removes the element located at the index pos from a sequence and stores it to the variable var_elem. The first two variants remove the element form the sequence seq; the parameter itself is, however, left unchanged. The modified sequence is returned as the function result. The other two variants change the value of the variable or data item var_seq. The removed item is stored to the variable (or data item) denoted by the l-value var_elem. The type of the variable/data item must be the same as the element of the sequence.

Parameters

seq
The sequence to be modified.
var_seq
An l-value of a sequence type, the value of which is to be changed.
pos
The position, from which to remove elements (the type Int). The index 0 denotes the beginning of the sequence. If the position is negative or beyond the sequence size, an error is returned.
var_elem
An l-value of the same type as sequence elements. The value of the removed item will be stored to this variable.

Return Value

The first variant returns the modified sequence, which is of the same type as the parameter seq.
The latter variant returns l-value referring to the variable var_seq.

See Also