title: How to understand this code of finding the longest word
body: <p>I'm currently studying "Ruby language" and I get stuck at "<code>enumerable</code>" I tired hard to understand it, but still, here is an example.</p>
  
  <pre><code>my_array = %w{this is a test of the longest word check} 
  longest_word = ''
  
  my_array.each do |word|
    longest_word = word if longest_word.length &lt; word.length
  end
  
  puts longest_word
  #=&gt; longest
  </code></pre>
  
  <p>I could understand almost every single line except  <code>longest_word = word if longest_word.length &lt; word.length</code> i guess this is also the main part of this program, How could it get the wanted result by doing a comparison  like this? </p>
  
  <p>At first i thought <code>longest_word</code>  is a default method, but it's obvious  not true. And then i refer it to "enumerable" Does it mean when each iterator iterating the words starting from the shortest until  the longest , Is that how we get the wanted result, Hope someone can help me to understand this more deeply and clearly.</p>