Skip to content

Instantly share code, notes, and snippets.

@btipling
Last active August 29, 2015 14:13
Show Gist options
  • Save btipling/00dce8789edc40c3b5cf to your computer and use it in GitHub Desktop.
Save btipling/00dce8789edc40c3b5cf to your computer and use it in GitHub Desktop.
func myFunctionDoubleVariables (thing: Thing?) {
let foo_ = thing?.getAFoo()
if foo_ == nil {
return;
}
let foo = foo_!
foo.bar()
foo.dostuff()
foo.morestuff()
}
func myFunctionExclamationsForDays (thing: Thing?) {
let foo = thing?.getAFoo()
if foo == nil {
return
}
foo!.bar()
foo!.dostuff()
foo!.morestuff()
}
func myFunctionNesting (thing: Thing?) {
if let foo == thing?.getAFoo() {
foo!.bar()
foo!.dostuff()
foo!.morestuff()
}
}
func myFunctionAwesome (thing: Thing?) {
let foo = thing?.getAFoo ?? return
foo.bar()
foo.dostuff()
foo.morestuff()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment