Created
January 13, 2017 16:24
-
-
Save chreke/893b1e8ced845e75639f1cd3abb04d18 to your computer and use it in GitHub Desktop.
Some Swift example code
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
var maybeString: String? | |
var maybeAnotherString: String? | |
maybeString = "hej" | |
// Optional binding | |
if let aString = maybeString { | |
print("This is a string: \(aString)") | |
} | |
// Optional chaining | |
let count: Int? = maybeAnotherString?.characters.count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment