5. Iterating over the Array issues


Hi guys. I followed the instructions exactly as stated in the example, and it still isn't working. What am I doing wrong?
Here is my code:
puts "Text"
words=text.split(" ")
"Text" => 21
words.each do |word| frequencies[word] +=1
puts frequencies[word]
Please help! Thanks (PS when I ran the code it kept telling me I had no key-value pairs, so I added one in and it still isn't working.)


Take a closer look at your array name. You got it correct but you used "word" instead of "words"


Did just that...it still says I haven't the frequencies hash correctly. Aaaaaahhhhhhh!!!!!!


@microslayer00982 this worked for me:

words.each {|word|
puts frequencies[word] += 1


Tried...Still the same thing...


I don't know where you got:

"Text" => 21

Try removing this and run the code I posted.
Also, it doesn't matter what you use inside | | it's just a placeholder.


You should try this one instead, this worked for me

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

Happy Coding