As we can see it caught the exception correctly. Begin 4 0 rescue exception puts can t divide a number by 0 end output. Can t divide a number by 0.