title: Saving highscores with NSUserDefaults
body: <p>I'm trying to save the highscore of my game. I'm trying to do this via <code>NSUserDefaults</code>. This is the code I'm using:</p>
  
  <pre><code>//To save highest score
  var highestScore:Int = 20
  NSUserDefaults.standardUserDefaults().setObject(highestScore, forKey:"HighestScore")
  NSUserDefaults.standardUserDefaults().synchronize()
  
  //To get the saved score
  var savedScore: Int = NSUserDefaults.standardUserDefaults().objectForKey("HighestScore") as Int
  println(savedScore)
  </code></pre>
  
  <p>But I get an error with <code>NSUserDefaults</code> saying "Expected declaration" and I can't figure out how to properly implement this. 
  Or should I be using <code>NSArchiver</code> for this? And if that is the case how could I implement this?</p>