aspose file tools*
The moose likes Ruby and the fly likes What is catch/throw ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Ruby
Bookmark "What is catch/throw ?" Watch "What is catch/throw ?" New topic
Author

What is catch/throw ?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hey,
In Ruby, begin/rescue/ensure are the equivalents for Java's try/catch/finally.
Ruby has catch/throw constructs, what are these?
Thanks.
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

http://ruby.activeventure.com/programmingruby/book/tut_exceptions.html
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

For all practical purposes, you'll probably never catch or throw. begin/rescue/end is primarily used and it's idiomatic in Ruby to simply return null or other default value from a method in *some cases* where Java would choose to throw an exception.


A good workman is known by his tools.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: What is catch/throw ?