Skip to content

lookup

Syntax

lookup(table_name,key_expression)

Parameters

table_name
The name of a table variable.
key_expression
An expression that evaluates to a number or to a list.

Returns

This action returns the value stored under the given key in the indicated table.

Description

This action returns the value stored under the given key in the indicated table.

If the key does not exist, a run-time error occurs unless the table has a defined default_value property, in which case the default value is returned. In that case, the default value is NOT inserted into the table as the value of the key.

This action is equivalent to table_name[key_expression].

Examples

The following example sets the lookup_value to 3

some_table[40] = 1
some_table[30] = 2
some_table[10] = 3
some_table[20] = 4
erase(some_table,40)
lookup_value = lookup(some_table,5*2)

or

lookup_value = some_table[5*2]

See Also