Detect division by zero: Difference between revisions

(→‎EasyLang: Add -inf checking in EasyLang example)
Line 2,040:
*inlr = *on;
</syntaxhighlight>
 
=={{header|RPL}}==
RPL provides targeted error detection and handling. In case of a division by zero, rather than displaying an error message, the program delivers the attempted arithmetic operation as an expression to be further processed.
≪ IFERR / THEN
SWAP "'" SWAP →STR + "/" + SWAP →STR + STR→
END ≫
'DIV' STO
6 2 DIV
4 0 DIV
{{out}}
<pre>
2: 3
1: '4/0'
</pre>
 
=={{header|Ruby}}==
1,150

edits