Created
November 25, 2015 18:39
-
-
Save BigZaphod/c228eb6cf2aba396db47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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