I am trying to get Value in a hash using its Key just like below.
#!/usr/bin/ruby
$, = ", "
months = Hash.new( "month" )
months = {"1" => "January", "2" => "February"}
keys = months.keys["1"]
puts "#{keys}"
I get following error
main.rb:7:in `[]': no implicit conversion of String into Integer (TypeError)
from main.rb:7:in `<main>'
Why am I getting above error?
months.keysis anArrayof keys, and arrays must be subscripted by integers.