Sorting the Hash - Help understanding


I'm trying to understand why my code will work with some text, but not others:

puts "Print text"
text = gets.chomp
words = text.split " "

frequencies =
words.each {|word| frequencies[word] = +1 }
frequencies = frequencies.sort_by {|x,  y| y }


words = text.split(" ")

should be += 1.


Thank you! That seems to have resolved my issue. Interesting that it would give me the green light with the incorrect syntax. @mtf


The SCT is only a 'soft' test for correct elements in the code. It often ignores console errors.