What is the difference between throw/catch and raise/rescue?
Answer Posted / Mansi Sonkar
In Ruby, `raise` is used to create and propagate exceptions. It allows you to define custom exceptions, signal errors, and handle them with `begin`, `rescue`, and `ensure`. On the other hand, `throw` and `catch` are lower-level mechanisms for sending and catching arbitrary values between methods. They are not directly related to exception handling.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers