null is not zero.

The concept of zero is not a concept of total lacking (ie, null) but one that describes a null count of something. The concept of null is a total lacking. Think black hole. Nothing there.

There isn't much use in real life of this understanding since there really isn't a total lack of something that we can describe. If we can describe it, it becomes a count of the described. However, in programming it is useful to know the difference between these two nothings. Thus the common error illustrated by this perl code:

my $var = shift() || 1; # assign default

which should be:

my $var = shift();
$var = 1 if !defined $var;

Being much uglier, the not-totally-paying-attention-programmer can sometimes opt for the former even if he knows better.

Log in or register to write something here or to contact authors.