Skip to content

Instantly share code, notes, and snippets.

@BigZaphod
Created November 25, 2015 18:39
Show Gist options
  • Save BigZaphod/c228eb6cf2aba396db47 to your computer and use it in GitHub Desktop.
Save BigZaphod/c228eb6cf2aba396db47 to your computer and use it in GitHub Desktop.
class Thing {
var something: Int? = nil
func doSomething() -> Int {
if something == nil {
something = 42
}
return something * 2 // compiler complains because it thinks "something" might somehow not have a value in some case
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment