RosettaCodeData/Task/Exceptions/Sidef/exceptions.sidef

12 lines
332 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
try {
die "I'm dead!"; # throws an exception of type 'error'
}
catch { |type, msg|
say "type: #{type}"; # type: error
say "msg: #{msg}"; # msg: I'm dead! at test.sf line 2.
};
say "I'm alive...";
die "Now I'm dead!"; # this line terminates the program
say "Or am I?"; # Yes, you are!