mapGet (Function)

Signature: mapGet(map: Map<string, t0>, key: string) -> Result<t0, Error>

Description: Returns the value associated with the key, or an error if the key is absent.

Parameters

  • map (Map<string, t0>): The map to look up in
  • key (string): The key to find

Returns: Result<t0, Error>

Example

match mapGet(scores, "alice") {
  Success { value } => print(value)
  Error { message } => print(message)
}
match mapGet (scores, "alice")
    Success value => print value
    Error message => print message