From: Ben Ben Date: 2009-12-26T08:21:50+09:00 Subject: Re: Making a counter for each word's occurrences in a string Phillip Gawlowski wrote: > On 25.12.2009 22:47, Ben Ben wrote: > >> Thanks Stefano, I got the idea! Especially when you explain the line 6, >> it's clearer to me now. So whatever for loop did before line 6, all of >> those are stored in memory, then when you called line 6, it will return >> only the value part that got added to the hash a moment ago at one go >> right? I hope that is what you mean. > > Close. "counts", or, by extension, "return counts", hands the result of > the method back to the caller. It includes all the results the method > has produced (in your example, the word count). > > To illustrate with a metaphor: > A method is like a production line at a factory. > > It takes raw materials (input), and produces a good (a result). This > production line can be simple, like making nails out of metal bits (a > word count), to a whole car (a webapp, or a desktop application). Thanks Phillip, I got it now. Awesome! Ya, it is going to take me a while before I can truly know Ruby and programming in general. -- Posted via http://www.ruby-forum.com/.