R
Ruby Newbee
Helo,
How to convert an array to a hash?
for example,
to:
And, for creating an array quickly, I could say:
x = %w/a hello b world c welcome d baby/
but how to creat a hash like this way?
Thanks.
How to convert an array to a hash?
for example,
=> ["a", "hello", "b", "world", "c", "welcome", "d", "baby"]
to:
=> {"a"=>"hello", "b"=>"world", "c"=>"welcome", "d"=>"baby"}
And, for creating an array quickly, I could say:
x = %w/a hello b world c welcome d baby/
but how to creat a hash like this way?
Thanks.