Skip to content

Instantly share code, notes, and snippets.

@yarneo
Created February 6, 2016 19:53
Show Gist options
  • Save yarneo/142198207d1a407aac3d to your computer and use it in GitHub Desktop.
Save yarneo/142198207d1a407aac3d to your computer and use it in GitHub Desktop.
func bouncerResponse(job: String, age: Int, bribe: Int) -> String? {
switch (job, age, bribe) {
case (let j, _, _) where (j.rangeOfString(“model”) != nil) :
return “come in, welcome, the VIP is that way :)”
case (_, 0..<21, _): return “too young bro”
case (“Owner of OMNIA”, 32, _):
return “sorry, we don’t let our competitors in”
case (_, _, let b) where b >= 100:
return “Welcome to our nightclub!”
default: return “sorry, we are at full capacity”
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment