Lingo Dictionary > G-K > getOne()

 

getOne()

Syntax

list.getOne(value)
getOne(list, value) 

Description

List function; identifies the position (linear list) or property (property list) associated with the value specified by value in the list specified by list.

For values contained in the list more than once, only the first occurrence is displayed. The getOne command returns the result 0 when the specified value is not in the list.

When used with linear lists, the getOne command performs the same functions as the getPos command.

Example

This statement identifies the position of the value 12 in the linear list Answers, which consists of [10, 12, 15, 22]:

put Answers.getOne(12)

The result is 2, because 12 is the second value in the list.

Example

This statement identifies the property associated with the value 12 in the property list Answers, which consists of [#a:10, #b:12, #c:15, #d:22]:

put Answers.getOne(12)

The result is #b, which is the property associated with the value 12.

See also

getPos()