Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Alphonse Cuccurullo
Alphonse Cuccurullo
2,513 Points

To_sym isnt working.

To_sym method isnt converting for some reason. Its suppose to iterate and convert everything

animes = { "dragonballz" => 5, "dragonballSuper" => 4, "DragonballGT" => 3.5}

def add_hash(hash) puts "Please add a anime!" loop do adding = gets.chomp hash[adding] puts "Please add a rating!"
rating = gets.chomp hash[adding] = rating.to_i puts "Wanna add another?" answer = gets.chomp if answer == "No" break end end end

def clearer(ha) ha.clear end

def to_sym(hasher) puts "Now converting to sym!" hasher.to_sym.each do |par| puts par end end

add_hash(animes) puts animes clearer(animes) puts animes

animes["fuck"] = 3

puts animes

to_sym(animes) puts animes

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Alphonse, could you be more clear here? What exactly should the code do and what happens instead?