cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scanner bug (was: cons 2.1.2 issues)


From: Johan Holmberg
Subject: Re: scanner bug (was: cons 2.1.2 issues)
Date: Fri, 3 Nov 2000 14:26:19 +0100 (MET)

On Fri, 3 Nov 2000, Brad Garcia wrote:
> 
> Question for the perl experts: when was the "do while" loop added to
> perl?  I cannot find any documentation for a "do while" loop.  I'm
> wondering if Zach has an older version of perl which doesn't understand
> it.
> 
> In the perl documentation, there is a "do" command which takes a block
> argument.  All it does is run through the code in its argument ONCE.
> This could explain why his array has at most one value.
> 

You are right that there doesn't exist any "do while loop".
BUT, the "while" can be used as a "statement modifier" that can
be added at the end of any statement (for example a "do { }").

And I think this has been in perl from the start, at least the
following works when I try it on 4.0.1.8 (patchlevel 36) from 1991:

    $ perl -e '$i=10; do { print "hello $i\n"; } while $i-- > 0'
    hello 10
    hello 9
    ...
    hello 0


/johan holmberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]