On 11/09/18 17:11, yary wrote:
> "Nil... it's a constant, so you have to use =:= to check for equality."
>
> Can you elaborate on that requirement? == works for an equality checks
> with numeric constants- must be more than Nil's constant-ness that
> makes one use =:= - perhaps that Nil doesn't numify to anything?

Nil does numify, but using == comparison for this is still problematic
for two reasons:

1) Nil numifies to 0, which is a valid "true" result for the index
method and
2) it outputs a warning:

    Use of Nil in numeric context
      in block <unit> at -e line 1

using ~~ instead of =:= should also be okay, or checking for definedness
with either .defined or using "with" instead of "if", which is very
useful especially for index and friends.

HTH
  - Timo

Reply via email to