This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is catch/throw ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 433
Netbeans IDE
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic