Anonymous user
Detect division by zero: Difference between revisions
→{{header|Smalltalk}}
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
|||
Line 2,077:
Transcript show:'bad bad bad, but I already told you in the handler'.
].</lang>
Note: works in all Smalltalks: printf is
Alternative version, which gets any block as argument, evaluates it and returns true, if ZeroDivide happened (works in all Smalltalks):
Line 2,094:
testZeroDivide value: [2/0] "------> true"</lang>
of course, as ZeroDivide inherits from Error, you could also write <
=={{header|SNOBOL4}}==
|