Syntax
fromkeys(array, [integer])
Description
The fromkeys() function returns a hash with the specified keys and the specified value. The value defaults to 0 if none is given.
Example
x = [“key1”, “key2”, “key3”]
y = 0
MyHash = fromkeys(x, y)
println(MyHash)
MyHash = fromkeys(x, 10)
println(MyHash)
{“key3”: 0, “key1”: 0, “key2”: 0}
{“key1”: 10, “key2”: 10, “key3”: 10}