Variable used before being initialized in function
<p>I'm making a <a href="https://en.wikipedia.org/wiki/Rock-paper-scissors" rel="nofollow">ro sham bo</a> game. Functions in swift are different than what I have used before. I keep getting an error:</p>

<blockquote>
  <p>Variable used before being initialized in function</p>
</blockquote>

<p>What am I doing wrong?</p>

<pre><code>import Foundation
import UIKit
class Result: UIViewController {
    var rval: Int?
    var chosen: Int?
    func determineWinner() -&gt; Int {
        var returnval: Int
        if (chosen == rval){
            returnval = 2
        }
        else if (chosen == 1 &amp;&amp; rval == 3){
            returnval = 1
        }
        else if (chosen == 1 &amp;&amp; rval == 2){
            returnval = 0
        }
        else if (chosen == 2 &amp;&amp; rval == 1){
            returnval = 1
        }
        return (returnval)
    }

    @IBOutlet weak var wl: UILabel!

    @IBAction func PlayAgain(sender: AnyObject) {
    }
    override func viewDidLoad() {
        print(chosen)
    }
}
</code></pre>