Created
January 13, 2017 16:24
-
-
Save chreke/351e022def61fe77c9330787c709d2b1 to your computer and use it in GitHub Desktop.
Some Swift example code
This file contains hidden or 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