Ruby - Error Handling
What will be the output of this Ruby code?
begin puts 100 / 0 rescue ZeroDivisionError puts "Division by zero error caught" end
begin puts 100 / 0 rescue ZeroDivisionError puts "Division by zero error caught" end
ZeroDivisionError.rescue ZeroDivisionError block catches this exception and prints the message.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions