Skip to content

Instantly share code, notes, and snippets.

@dmauro
Created August 5, 2014 05:22
Show Gist options
  • Save dmauro/489b680ac2ca9a5b414f to your computer and use it in GitHub Desktop.
Save dmauro/489b680ac2ca9a5b414f 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
println("optional") // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment