Skip to content

Instantly share code, notes, and snippets.

@hvsw
Last active February 15, 2016 05:42
Show Gist options
  • Save hvsw/64670ba86654d79d41dc to your computer and use it in GitHub Desktop.
Save hvsw/64670ba86654d79d41dc to your computer and use it in GitHub Desktop.
func calculate() {
do {
let x:Float = 2.0
let y:Float = 2.0
let result = try divide(x, y)
resultLabel.text = String(result)
} catch DivisionErrorEnum.DividendIsZero(let msg) {
print(msg)
} catch DivisionErrorEnum.DivisorIsZero(let msg) {
print(msg)
} catch let error {
print(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment