title: comparison of string with nil failed
body: <p>Im trying to write a loop that counts the number of capitals in a word. When I run this code I get an error stating that nil can't be compared to a string. I don't understand this because I am comparing a a string to a string?</p>
  
  <pre><code>passwort = gets.chomp
  i = 0
  capitals = 0
  while(i &lt; (passw0ort.length) + 1) do
      if('A' &lt;= passwort[i] &amp;&amp; passwort[i] &lt;= 'Z')
          capitals = capitals + 1
      else
          end
      i = i + 1
  end
  </code></pre>
  
  <p>Greetings Patrick</p>