[Tucson-pm] while and until statements

Day Irmiter day at irmiter.com
Fri Dec 10 22:51:27 CST 2004


Thank you, Jasvir, especially for clearing my misapprehension that $x++ was executing and that was how $x increased in value. Thanks again, also, to Paul Scott for kindly resolving my confusion.

> You have a minor bug in CODE_2 which is responsible for the difference.
> It ought to read:
> 
> $x = 1;
> until ($x == 4)               # == tests equality, = is assignment
> {
>     print "$x\n";
>     $x++;
> }
> 
> If you use assignment, the $x is assigned 4 immediately which is
> interpreted as true so print never executes.
> 
> -- Jasvir
> 
> On Thu, 2004-12-09 at 23:35 -0700, Day Irmiter wrote:
> 
>> . . . with the until statement, the print statement does
>> not execute. And yet, if the . . . code is run under the
>> debugger, it will be seen that $x is incremented to 4. . . .



More information about the Tucson-pm mailing list