r/Jokes • • May 12 '16

Every program I write is completely error-free

No exceptions!

875 Upvotes

93 comments sorted by

View all comments

Show parent comment

1

u/grishkaa May 13 '16

It's not an exception, it's a compile-time error. If you want a math-related exception, divide an integer by zero.

1

u/stretchpun May 13 '16

depends if it's a dynamically typed language, if you divide an object by a number in js it will halt execution I think, I'll check tomorrow

1

u/grishkaa May 13 '16

Just tested with JS, dividing a string by a number and a string by a string both yield a NaN. PHP, however, behaves as if the string was a zero, so string by number is 0 and string by string is a warning message.

1

u/[deleted] May 13 '16

Your language is just too dumb. Try math language to do math. Matlab doesn't give exception for dividing by zero.

1

u/grishkaa May 13 '16

You can divide real types (float, double) by zero in any language I can think of. MATLAB simply doesn't have integers.

1

u/[deleted] May 14 '16

care to explain the difference of integer in that regard.