title: “MAP::DELETE” author: “laplante@plcb.ca” date: 2024-09-24 version: “1.0.0” section: “1g”
map::delete — Remove one or more keys from a map
map::delete(map[, key…])
The map::delete
function removes one or more keys from a map.
This allows for flexible and efficient cleanup of map entries.
res = {{
m := { "x": 1, "y": 2, "z": 3 };
delete(m, "a", "x", "z"); // deletes "x" and "z", ignores "a" since it doesn't exist
m;
m = { "x": 1, "y": 2, "z": 3 };
delete(m, ["a", "x", "z"]); // deletes "x" and "z" again
m;
}}.
// Result:
res = {"y":2}{"y":2}
laplante@plcb.ca