"value" (mapping::value)
Returns the value at given key or the defaultValue if the key is not found.
Synopsis
T mapping.value(T key, T defaultValue = anytype());
Parameters
| Parameter | Description |
|---|---|
| key | Mapping key |
| defaultValue | Value that is returned if key does not exist. |
Description
Returns the value associated with the given key. If the key does not exist, the optional defaultValue is returned.
Example
main()
{
mapping m = makeMapping("city", "Vienna", "country", "Austria");
DebugN(m.value("city")); // "Vienna"
DebugN(m.value("name", "unknown")); // "unknown"
}
Assignment
Mapping
