title: Swift nil has a numeric value?
body: <p>This is valid code in Swift:</p>
  
  <pre><code>println(nil &lt; 1)
  </code></pre>
  
  <p>And the output will be true, likewise</p>
  
  <pre><code>println(nil &gt; 1)
  </code></pre>
  
  <p>will be false (the number 1 is arbitrary, you can do the same for -1 and probably something else). The reason I ask is because I saw some code that tried to compare <code>"some_string".toInt()</code> to a numeric value and it compiled, which seems wrong considering <code>toInt()</code> returns <code>Int?</code>.</p>
  
  <p><strong>My question is, should this be valid syntax in Swift? If so, what is the numeric value of nil?</strong></p>
  
  <hr>
  
  <p><strong>Swift 3.0 Update:</strong></p>
  
  <p>Looks like Swift Evolution tackled this issue by <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0121-remove-optional-comparison-operators.md" rel="nofollow noreferrer">removing the optional comparison operators</a>. This is no longer an issue in Swift 3.0 as it doesn't compile.</p>