2 ms·
> I don't see how it's wrong to use an if statement to check that nobody's passing in a zero to your function that later does division using that variable. Ind
by pif 2y ago
> I don't see how it's wrong to use an if statement to check that nobody's passing in a zero to your function that later does division using that variable.
Indeed, it isn't. The check becomes useless if it happens after the division, though.
- nemetroid 2y agoOr if the check does not prevent the division (the typical "time-travel" example).