title: Missing return in a function Swift
body: <p>I'm getting this error <code>Missing return in a function expected to return "User"</code> for this code:</p>
  
  <pre><code>var winner : User? {
  
      if player1TotalScore &gt; player2TotalScore {
          return player1
  
      } else if player1TotalScore == player2TotalScore {
          return nil
      }
  }
  </code></pre>
  
  <p>The most curious thing about this is that I do basically the same thing a few lines up:</p>
  
  <pre><code>var opponent : User! {
      if player1.isEqual(User.currentUser()) {
          return player2
      } else {
          return player1
      }
  }
  </code></pre>
  
  <p>What am I doing wrong in the first bit of code?</p>