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 |
Why Ruby is known as a language of flexibility?
what is the purpose of the rakefile available in the demo directory in ruby?
In how many ways you can compare Ruby string?
How to write multiline string in Ruby?
Tell me how do you remove nil values in array using ruby?
How is an iterator handled in ruby?
What is a symbol in ruby?
What is concatenating string in Ruby?
How would you implement hash in ruby internally?
Explain module mixins in Ruby?
How ruby looks up a method to invoke?
How is object methods defined in ruby?