[Solved] Error "Can't convert a string into a integer"


#1

puts "Write your text for analysis here:"
text = gets.chomp
words = text.split(" ")
frequencies = Hash.new(0)
words.each do |word| frequencies[word] += 1
frequencies = frequencies.sort_by do |word, count| count
end
frequencies.reverse!
end

Can anyone help with this code? error is "can't convert a string into a integer"

UPDATE:I opened code academy in another browser, Mozilla and I was in the next chapter. Did a logout and long in again and I was int the next chapter, somehow. Anyway my thank for have a look in this topic.

UPDATE II: Apparently, this error happens because of the misuse of the expression «do». Basically the code works with {} instead of «do».