I can’t seem to get this code to work, despite reading previous answers on the forum. Can anyone advise a newbie, please?

puts "What’s your text? "
text = gets.chomp

words = text.split
frequencies =
words.each do { |word| frequencies[word] += 1 }
frequencies = frequencies.sort_by {|a, b| b}

Also, I have followed the logic of the previous lessons just fine, but this one eludes me. Clarification would be appreciated. Thank you.


The above is throwing an error because it is not a part of any code body. The do has a block.

Otherwise, your code looks fine.