Category:Smalltalk: Difference between revisions

Content added Content deleted
Line 543: Line 543:


Handlers can also be defined to handle a collection of non-related exceptions, by creating an exceptionSet:
Handlers can also be defined to handle a collection of non-related exceptions, by creating an exceptionSet:
<lang smalltalk>[ try block to be evaluated ] on: ZeroDivide, DomainError do:[:ex | handler ]</lang>
<lang smalltalk>[ try block to be evaluated ] on:(ZeroDivide, DomainError) do:[:ex | handler ]</lang>
finally, many dialects provide syntactic sugar for common situations:
finally, many dialects provide syntactic sugar for common situations:
<lang smalltalk>exception catch: [ action ] "to return out of the action, without any particular handler action"
<lang smalltalk>exception catch: [ action ] "to return out of the action, without any particular handler action"