Re: Testing for NULL
- Posted by petelomax Sep 02, 2015
- 1992 views
SDPringle said...
Some of us, like myself, say the user should have a set dummy value as values can be either atoms or sequences.
When I read that I suddenly realised that a suitable dummy value could be 0.0 - ie:
if not integer(d) and d=0 then -- it /is/ the special dummy value
Of course you'd need some way to artificially create such a beast, and there are a couple of billion other "special values" that should not occur in normal code.
Pete
EDIT: Mind you, it could cause massive confusion and panic when things start being 0 and not 0 at the same time... And of course the d=0 as shown above would be optimized to false because the stupid compiler knows that d is not an integer, though you could use d=MYDUMMY instead. I'll get me coat.