Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: do while loops

by Anonymous Monk
on Jan 20, 2006 at 22:10 UTC ( #524598=note: print w/ replies, xml ) Need Help??


in reply to Re: do while loops
in thread do while loops

Actually, I think the problem is larger than that.
shouldn't it be:

$value = 15; # 15, not 5. 5 doesn't make sense if we're not increment +ing. do { print "$value\n"; $value = $value - 1; } while($value > 10);

jdporter fixed formatting


Comment on Re^2: do while loops
Download Code
Re^3: do while loops
by Roy Johnson (Monsignor) on Jan 20, 2006 at 22:25 UTC
    The point was that the test happens at the end, so the loop executes once even if the value starts out < 10.

    Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2015-07-03 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls