Tuesday, April 26, 2011

Iterating through keys of hashmap in Ruby

Way 1:
hashmap.each_key do |key|
  puts key
end

Way 2:
hashmap.each do |elem|
  puts elem[0]
end

No comments:

Post a Comment