On Mon, Apr 29, 2002 at 04:25:26PM -0700, Peter Scott wrote:
> At 01:55 PM 4/29/02 -0500, Allison Randal wrote:
> >
> >There will have to be a section of the training material devoted to
> >"When is a loop false?" (I like that perspective, it nicely unifies the
> >cases), but it should be a short one.
> 
> I would have said that the value of a loop was the value of the last 
> expression evaluated in it (and undef or empty list for loops that didn't 
> execute at all).  Which means that some loops could execute and still be 
> false.  Is this hopelessly retrograde thinking?  

Talking about a loop being false is not an inaccurate statement, it's
just not as detailed in accuracy as it could be. Loops don't really have
return values (you can't assign a loop to a variable, capturing its
value). To be entirely accurate you'd have to say "When will the
condition for the loop cause it not to execute?" but that's not nearly
memorable enough. So it's an abstraction for the sake of exposition.

The answer is the same, in any case: "When the condition in the
C<while> has a false value, when the list/array in the C<for> is empty,
or when the condition (2nd expression) in the C<loop> is met on the first
comparison."

> Are the hordes of programmers yet-to-be that will be weaned
> exclusively on Perl 6 look scornfully on me for such opinions and say,
> "There goes another Perl 5 programmer, pass the Geritol"?

Who knows what they'll think of us? They'll probably all be wearing
brightly colored latex body suits with communication/computation devices
embedded on every surface too. ;)

Allison

Reply via email to