title: Learning ruby for loop
body: <p>Hi I'm going through this loop and sending a list of words <code>lines</code> and a string <code>str</code> to match it. For some reason it's not printing <code>eureka</code> though:</p>
  
  <pre><code>def search_array(str, lines)
      count = 0
      lines.each do |i|
          count +=1
          if str == i
              puts 'eureka'
          end
      end
  end
  
  FILE_LOC = "words.txt"
  lines = File.readlines(FILE_LOC)
  word = "hello"
  
  search_array(word, lines)
  </code></pre>