Name

select — Selet a list element

Synopsis

any select ( list  LIST ,
  integer  INDEX ,
  any  DEFAULT );

Parameters

list LIST

integer INDEX

any DEFAULT

Return

any

Description

Gets the INDEX'th value of a list. The first value has the index 0. The call select([1,2,3], 1) thus returns 2. Returns DEFAULT if the index is invalid or if the found entry has a different type than the default value.

Usage

  select ([1, 2], 22, 0) -> 0
  select ([1, "two"], 0, "no") -> "no"