fork download
  1. @hh = {}
  2. def add_person options
  3. @hh [options[:name]] = options[:age]
  4. end
  5. def show_hash
  6. @hh.each do |key|
  7. age = @hh[key]
  8. puts "name: #{key}, age: #{age}"
  9. end
  10. end
  11. add_person :name => 'Walt', :age => 36
  12. show_hash
Success #stdin #stdout 0s 28216KB
stdin
Standard input is empty
stdout
name: ["Walt", 36], age: