Contents

Roo

Hash.value()

Returns the value for the specified key.

hash.value(key as Object) as Object or Nothing

Parameters

  • key. Object. The key of the key-value pair whose value you want

Returns

  • If key exists in the hash then its value is returned
  • If key doesn’t exist in the hash then Nothing is returned

Example

var h = {"a" => 1, "b" => 2}
var i = h.value("a")
var j = h.value("c")

print(i) # => 1
print(j) # => Nothing