Create an Histogram

could someone please explain section 8 in create an Histogram

Would you be willing to share your lesson 7 code with us, so we have something to work with? Please and thank you.


puts " your text please"
text = gets.chomp
words = text.split
frequencies =
words.each do
   { |word|
frequencies[word] += 1}
puts frequencies[word]

Here it is…

Can we start with this line? Is it correct?

Yes it is …

I don’t really what it all stand for … I’m very sorry but could you like break the whole code down…

Short answer: No. That is not in my purview.

Thanks … I think I get it …

I copied exactly what you wrote and it’s giving me a syntax error.

I’m also getting a syntax error

word is not defined in that scope, only in the block. To list the frequencies hash we need another loop: See lesson 1 for this example:

frequencies.each do |word, frequency|
    puts word + " " + frequency.to_s

The OP is missing some important code so hopefully nobody is trying to use it. Refer to lesson 1, and follow instructions closely.