setDefault( map, item )

Sets the default value for the specified map to the specified item. See modDefault 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.setDefault( "the default" );
There are 0 results
:-)
:-) map[ "akey" ];
There is 1 result
"avalue"
:-) map[ "differentkey" ];
There is 1 result
"the default"
      

The default value can be set to any MillScript object.