Skip to content

Instantly share code, notes, and snippets.

@aclissold
Created December 4, 2014 18:54
Show Gist options
  • Save aclissold/cc94d9b8c8567de9a5c4 to your computer and use it in GitHub Desktop.
Save aclissold/cc94d9b8c8567de9a5c4 to your computer and use it in GitHub Desktop.
let fruits = ["apple", "bananananana"]
/*
var s: String
if fruits.count == 1 {
s = ""
} else {
s = "s"
}
*/
var s = fruits.count == 1 ? "" : "s"
println("An array with \(fruits.count) thing" + s)
Copy link

ghost commented Dec 4, 2014

Lines 2-12 are redundant.

@aclissold
Copy link
Author

I kept in them because there's no hope of proving P = NP anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment