Win a copy of Functional Reactive Programming this week in the Other Languages 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