Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
XP is just a number
 
PerlMonks  

(Guildenstern) Re: Re: sleep?

by Guildenstern (Deacon)
on Mar 20, 2001 at 21:48 UTC ( #65760=note: print w/ replies, xml ) Need Help??


in reply to Re: sleep?
in thread sleep?

Then why not say -

do { print "I'm going to sleep\n"; } while (sleep(1))

:)

Guildenstern
Negaterd character class uber alles!


Comment on (Guildenstern) Re: Re: sleep?
Download Code
Re: (Guildenstern) Re: Re: sleep?
by Adam (Vicar) on Mar 21, 2001 at 00:39 UTC
    Yes, but note that do{}while(); is not actually a loop. You can't use loop control mechanics like last and next. This is noted under Universal Blunders, page 529 in Camel 2:
    • Using loop control statements in do {} while. Although the braces in this control structure look suspiciously like part of a loop BLOCK, they aren't.
    This is also mentioned here.
      Yes, but this is a simple example and does not use any loop control statements. myocom stated in his reply that the while(sleep(1)) construct would sleep first before showing any output - the opposite of what the original author was trying to do in the sample code. In this case, the do {} while () is a perfectly acceptable WTDI.

      Guildenstern
      Negaterd character class uber alles!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (17)
As of 2013-06-19 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many continents have you visited?









    Results (663 votes), past polls