Skip to content

default_value

Syntax

<table-variable>.default_value = <value>

Description

Sets the default value to return when a lookup operation in a table fails to find the specified key.

Table items can be accessed using the action lookup or by using the notation shown:

my_value = lookup(table_name, key)
my_value = table_name[key]

When looking up values in a table, an error occurs if the key does not exist, unless the table has a default_value property, in which case the default value is returned as the value of the lookup.

Examples

The following declares a table variable called lookup_table1 with a default value of -1.

variables {
    table lookup_table1
    lookup_table1.default_value = -1
}

See Also