in reply to My habitual errors
Even after all this time, I still sometimes inadvertently use assignment instead of testing for numeric equality:
if ($first = $second) { # do something } else { # this code is never executed since assignment to $first always retu +rns true }
Sigh. It is dumb, but I did it just last week.
Update: as pointed out by jdporter, in cases where $second evaluates as false, the resulting assignment to $first will also return false. While this rarely happens to me (since I'm usually trying to evaluate numerical equality between non-zero variables), it is an important distinction.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: My habitual errors
by imp (Priest) on Apr 04, 2007 at 17:29 UTC | |
Re^2: My habitual errors
by jdporter (Paladin) on Apr 04, 2007 at 17:33 UTC |
In Section
Meditations