Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: until loops

by lvanhout (Curate)
on Jun 16, 2004 at 05:11 UTC ( #367116=note: print w/ replies, xml ) Need Help??

in reply to until loops

I usually find it a little cleaner to say

until($year >= 2000)
That is to say continue until year is greater than or equal to 2000. In case you go back and change your code within the loop and do something more complicated than increment.

Unless you really mean that only 2000 is an escape loop case and 2001 and up will be continue loop cases.

Comment on Re: until loops
Download Code
Replies are listed 'Best First'.
Re^2: until loops
by apotheon (Deacon) on Oct 11, 2004 at 00:05 UTC
    On the other hand, with only the == instead of >=, it's a perfectly appropriate demonstration of the concept. I'm not sure, but if compiled, the == might actually execute faster than the >=, though by such a minute margin that it's effectively useless to differentiate.

    - apotheon
    CopyWrite Chad Perrin

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2015-11-30 20:58 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (783 votes), past polls