Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Re: while loops

by rob_au (Abbot)
on Jan 11, 2002 at 18:41 UTC ( #138011=note: print w/replies, xml ) Need Help??

in reply to Re: while loops
in thread while loops

No, not at all - Your code will only pass through a single iteration of the loop as on the first pass, the value of $num is added to $num. The result is that $num equals 40 and the while loop is exited. I think you may have been meaning, ignoring formatting syntax errors ...

$num = 20; while ($num < 30) { print "num is $num\n"; ++$num; }

Although, good pick up on the syntax error with the line - $while($num<30){ - Although this had been addressed previously within this thread.


perl -e 's&&[@.]/&&s&.com.&_&&&print'

Replies are listed 'Best First'.
Re: Re: Re: while loops
by Glyndwr (Initiate) on Jan 11, 2002 at 19:11 UTC
    yes , thanks

    in this case would $num++ also work

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (16)
As of 2016-10-25 13:52 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (320 votes). Check out past polls.