API Reference › Dict › Dict.get_or
method

Dict.get_or

Dict.get_or(d, key, fallback) -> int

Returns the value for key, or fallback when the key is absent — the unambiguous lookup when 0 could be a real value.

Example

program Demo {
  handler Step phase Update {
    let n = Dict.get_or(bank, "stone", 0 - 1)
  }
}
← All symbols