RosettaCodeData/Task/Flow-control-structures/Ruby/flow-control-structures-1.rb
2023-07-01 13:44:08 -04:00

13 lines
291 B
Ruby

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