Create an empty table:
Create a table with two entries 1=22 and 2=42:
| (2) |
Create a table with two entries at specified indices:
>
|
|
| (3) |
Fetch a value from a table using square-bracket notation:
When an index doesn't map to a value, the query will return unevaluated:
Use the assigned function to check if an entry exists
The sparse indexing function can be used to set a default for lookups rather than returning unevaluated
>
|
|
The default for sparse tables is to return 0 when an index is not found. This can be changed to a constant value that you choose:
>
|
|
>
|
|
Other indexing functions control the lookup based on indices and/or entries in the table:
>
|
|
| (11) |
A table can contain callable procedures:
>
|
|