Detect division by zero: Difference between revisions

Line 2,104:
<lang smalltalk>|a b result|
a := 10. b := 0.
result := [a / b] on:ZeroDivide do:[:ex | ex proceedWith:Float NaNinfinity].
Transcript showCR:result.</lang>
will show "naninf" on the console window.
 
=={{header|SNOBOL4}}==
Anonymous user