In ruby to catch an error one uses the rescue
statement. generally this statement occurs between begin
and end
. One can also use a rescue
statement as part of a block (do ... end
) or a method (def ... end
). My question is what other structures (loop, while, if, ...) if any will rescue nest within?
views:
132answers:
1`module` and `class` bodies are implicit `begin` blocks, too.
Jörg W Mittag
2010-03-26 18:01:26
@Jörg W Mittag: as are `do ... end` blocks and `def ... end` method definitions. IS there anything else that is an implicit `begin`? `while`, `case`, or `if` for example?
John F. Miller
2010-03-28 01:24:32
@john - do...end isn't an implicit begin...end.
klochner
2010-03-28 02:20:56