Get all values as an array : Hash values « Hash « Ruby






Get all values as an array

hash = {1 => 2, 2 => 2, 3 => 10}
p hash.values                                  # => [2, 2, 10]

 

Related examples in the same category

1.Get an array with all the values from a hash with values:
2.what is the default value for a hash