![]() |
|
Navigation |
Synopsis Delete an element from a list.
Function
list[&T] delete(list[&T] lst, int n)
Usage
import List;
Description Delete the
n -th element from a list. A new list without the n -th element is returned as result.
The IndexOutOfBounds exception is thrown when n is not a valid index.
Examples
rascal>import List; ok rascal>delete([1, 2, 3], 1); list[int]: [1,3] rascal>delete(["zebra", "elephant", "snake", "owl"], 2); list[str]: ["zebra","elephant","owl"] Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]()
Question [3].
![]() ![]() ![]() |