default_value
Set the default value to return when a lookup operation in a table fails to find the specified key
Synopsis
<table-variable>.default_value = <value>
Description
Table items can be accessed using the function 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
}