Skip to content

Instantly share code, notes, and snippets.

@dolphinsue319
Last active October 10, 2015 08:44
Show Gist options
  • Save dolphinsue319/fc4e1ce9d130f4e12378 to your computer and use it in GitHub Desktop.
Save dolphinsue319/fc4e1ce9d130f4e12378 to your computer and use it in GitHub Desktop.
用 switch 語法解決 <>== 0 的問題
let x = 1
switch x {
case _ where x > 0:
print("> 0")
case _ where x < 0:
print("< 0")
default:
print("== 0")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment