Iterating over the array


#1



https://www.codecademy.com/courses/ruby-beginner-en-693PD/0/5?curriculum_id=5059f8619189a5000201fbcb#


it seems that i have the same code as everyone else here but i get the following error message

can't convert String into Integer


puts "tell me something:"
text = gets.chomp
words = text.split()

frequencies = Hash.new(0)

words.each do |word|
    frequencies=frequencies[word] += 1
end


#2

i realise my error now. can i delete this post?


#3

You most definitely can!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.