Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: until loops

by Frey (Novice)
on May 13, 2001 at 20:34 UTC ( #80054=note: print w/replies, xml ) Need Help??

in reply to until loops

Actually, this is not an infinite loop. This loop is always false until it evaluates 2000,
in which case it is true, and it stops. I got hung up on this too, I think the backwardness of until can be confusing.

Replies are listed 'Best First'.
Re: Re: until loops
by Anonymous Monk on Sep 03, 2003 at 09:44 UTC
    I dont think that is correct, the expression "$year==2000" will be false if $year is not 2000 but the actual statement of unless($year==2000) will be true unless year equals 2000. Also an infinite loop is one where the condition will never be met and so will never terminate, in this case if year will never become 2000. For example, if year was initialised to 2001 or if year was 1999 and never incremented then it is an infinite loop.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://80054]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2023-05-31 10:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found