Skip to content

Instantly share code, notes, and snippets.

@dmauro
Created August 5, 2014 05:26
Show Gist options
  • Save dmauro/c9b17e95103b35e26b3b to your computer and use it in GitHub Desktop.
Save dmauro/c9b17e95103b35e26b3b to your computer and use it in GitHub Desktop.
// Swift in beta 4
if (optional?.methodReturningBool()) {
println("awesome")
}
// Swift in beta 5
if (optional != nil && optional!.methodReturningBool()) {
println("damnit...")
}
// Why not have our cake and eat it too?
// This would be great:
var optional: Bool = nil
println(optional?) // false
optional = false
println(optional?) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment