What is the difference between throw/catch and raise/rescue?
Answer / 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 |
What are the case statement in ruby?
what is the difference extend and include?
what is the purpose of the rakefile available in the demo directory in ruby?
Explain me what is the difference between symbol and string?
Explain the three levels of access control for ruby methods?
List some features of ruby?
What things we can define in the model?
How ruby looks up a method to invoke?
Explain until loop in ruby.
Explain how Symbol is different from variables?
Explain the role of modules and mixins in ruby?
How to use ruby methods.