Iterating over the array - undefined method `new' for #<Enumerator: ["gr"]:each>


I keep getting the message...undefined method `new' for #Enumerator: ["gr"]:each


Here is my code:

puts "Type in text here"
text = gets.chomp
words = text.split
frequencies = (0)
words.each {|word| frequencies [word] +=1}


please ignore!....i simply was typing in a single word instead of a sentence which prompted the error.


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