Returns the specified map, with it's default value set to
the specified item. See setDefault for an alternative way of setting
the default value.
The default value is returned when a map is indexed by a key which is not present in the map.
The default default value is absent. The default value for a given map can be found by using the getDefault function.
:-) var map = newMap(
:-) "akey" ==> "avalue"
:-) );
There are 0 results
:-) map.modDefault( "the default" );
There is 1 result
{akey=avalue}
:-)
:-) map[ "akey" ];
There is 1 result
"avalue"
:-) map[ "differentkey" ];
There is 1 result
"the default"
This function allows you to write slightly more compact code, when you need to create a new map, with a specific default value and assign it to a variable. e.g. the map/default value definition in the above example could be written:
:-) var map = newMap(
:-) "akey" ==> "avalue"
:-) ).modDefault( "the default" );
There are 0 results
The default value can be set to any MillScript object.