RosettaCodeData/Task/Flow-control-structures/Ruby/flow-control-structures-1.rb

14 lines
291 B
Ruby
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
begin
# some code that may raise an exception
rescue ExceptionClassA => a
# handle code
rescue ExceptionClassB, ExceptionClassC => b_or_c
# handle ...
rescue
# handle all other exceptions
else
# when no exception occurred, execute this code
ensure
# execute this code always
end