Gibt das n-te Element der Liste zurück. Das erste Element der Liste hat den Index 1. Wenn i 0 oder negativ ist, wird auch das erste Element zurückgegeben. Wenn i größer als die Länge der Liste ist, wird das letzte Element zurückgegeben.
nth ( i As Any; _ list As Any ) As Any
Argument | Typ | Beschreibung |
---|---|---|
i | Alle | Der Index des zurückzugebenden Elements |
List | Alle | Die Liste |
Intent >nth(3, {"a", "b", "c", "d", "e"}) --> "c"
Intent >nth(1, {"a", "b", "c", "d", "e"}) --> "a"
Intent >nth(0, {"a", "b", "c", "d", "e"}) --> "a"
Intent >nth(-1, {"a", "b", "c", "d", "e"}) --> "a"
Intent >nth(7, {"a", "b", "c", "d", "e"}) --> "e"
Intent >nth(2.7, {"a", "b", "c", "d", "e"}) --> "b"Der Index kann eine Zahl sein, die abgerundet wird.