views:

132

answers:

1

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?

+1  A: 
klochner
`module` and `class` bodies are implicit `begin` blocks, too.
Jörg W Mittag
@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
@john - do...end isn't an implicit begin...end.
klochner