title: Missing return in a function expected to return 'Int?' in swift
body: <p>Why does this error occur without the last return nil?
  Please understand that I am not good at English.
  Thank you for your answers.</p>
  <pre><code>func firstNonConsecutive (_ arr: [Int]) -&gt; Int? {
      var n = 0
      while n &lt; arr.count - 1 {
          if arr[n] + 1 != arr[n + 1] {
              return arr[n+1]
          } else {
              n += 1
          }
      }
      //return nil (Why can't I have this?)
  }
  </code></pre>