RosettaCodeData/Task/Associative-array-Creation/Ecstasy/associative-array-creation-3.ecstasy
2023-07-01 13:44:08 -04:00

7 lines
262 B
Text

Int? mightBeNull = map["foo"];
Int neverNull = map.getOrDefault("foo", 0);
if (Int n := map.get("foo")) {
// if "foo" is in the map, then the variable "n" is set to its value
} else {
// if "foo" is not in the map, then the variable "n" is not defined
}