Skip to content

Instantly share code, notes, and snippets.

@rmnblm
Last active December 12, 2016 07:53
Show Gist options
  • Save rmnblm/90dd009f55ca4878c61d7a98a31b2638 to your computer and use it in GitHub Desktop.
Save rmnblm/90dd009f55ca4878c61d7a98a31b2638 to your computer and use it in GitHub Desktop.
Swift: Optionals Part 3
// Declare two optional values
var firstName: String? = "Roman"
var lastName: String? = "Blum"
// Option 1: Nested
if let firstName = firstName {
if let lastName = lastName {
// Use firstName and lastName
}
}
// Option 2: Seperated by comma
if
let firstName = firstName,
let lastName = lastName {
// Use firstName and lastName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment