Find Procedure

Checks whether a map contains a given key, and returns the corresponding value if so.
Use the returned Optional with HasValue and Value.
Declaration
function Find(
map as Map from T1 to T2, key as T1
) as Optional T2

Parameters

Return value

Optional T2 — The value corresponding to the key, if it exists. Otherwise, an empty Optional is returned.

Example

Code
dim map foo
yield 1 to "a"
yield 3 to "b"
end dim
dim a = Find(foo, 1)
print "HasValue(a)="; HasValue(a)
print "Value(a)="; Value(a)
dim b = Find(foo, 2)
print "HasValue(b)="; HasValue(b)
Output
true
false