Name

select — Selects a list element (deprecated, use LIST[INDEX]:DEFAULT)

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.
Functionality replaced by syntax: list numbers = [1, 2, 3, 4];
numbers[2]:nil -> 3 numbers[8]:5   -> 5

Usage

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