[EMAIL PROTECTED] (Andrea Holstein) writes:

> In article <[EMAIL PROTECTED]> wrote "John W. Krahn" <[EMAIL PROTECTED]>:
[...]
> > "00" is TRUE
> > "0"  is FALSE
> 
> It's perhaps not so important for a beginners course,
> but important to know.
> 
> Last week, I wasted half an hour for understanding it.

Reason enough to include it in a beginner course!

When I get to the chapter on flow control, I say that we are
going to have a little talk about truth, then say that we're
actually only going to talk about false, since it's a
shorter talk (there being only 4 false values).  As a few
"trick" examples, I *do* put "0e0" and "00" (and "false") up
on the board along with other more-obviously true values
(e.g. 4, 42, "1", 1, "true"), but by then it's easy to see
that these values (I try to put them in green) do not match
the 4 false values (I try to put them in red).

And it's why I put it on the test.  It's the kind of thing
that needs to be drilled in so that it's in your
subconscious as you design the return value of reusable
subroutines and methods.  I often think, "How do I want to
return false/failure?  There's only 4 of 'em, which one
makes most sense in this context?  Now that I've figured out
the false/failure mode, the true/success value is much
easier".

-- 
Michael R. Wolf
    All mammals learn by playing!
        [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to