title: “MAP::EXIST Function” author: “Pierre Laplante laplante@plcb.ca” date: “2023-11-19” version: “1.0.0” section: “1g”
map::exist checks whether a specified string is defined as a key within a given map.
map::exist(map, key: string)
The map::exist
function checks whether a specified string is defined as a key within a given map.
It returns true if the key exists and false otherwise.
This function is useful for verifying the presence of keys before attempting to access their values, thereby preventing errors when dealing with undefined keys.
res={{
x := { "errcode" : 0 };
map::exist(x, "errcode"); // returns true
map::exist(x, "xerrcode"); // returns false
}}.
res=truefalse.
Pierre Laplante laplante@plcb.ca