RosettaCodeData/Task/Exceptions/E/exceptions-1.e

16 lines
248 B
Plaintext

def nameOf(arg :int) {
if (arg == 43) {
return "Bob"
} else {
throw("Who?")
}
}
def catching(arg) {
try {
return ["ok", nameOf(arg)]
} catch exceptionObj {
return ["notok", exceptionObj]
}
}