CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   ColdFusion (http://www.codingforums.com/forumdisplay.php?f=45)
-   -   How to loop to run a piece of code every second? (http://www.codingforums.com/showthread.php?t=242086)

eddyzhuo 10-26-2011 03:50 PM

How to loop to run a piece of code every second?
 
Can anyone show me a simple Coldfusion code to loop to run a piece of code every second? Thank you so much.

Gjslick 10-27-2011 06:08 AM

Not sure why you'd want to, but:
Code:

<cfloop from="1" to="5" index="i">
  <cfoutput>#i#</cfoutput>
  <cfset sleep( 1000 )>  <!--- Sleep for 1 second (1000ms) --->
</cfloop>

-Greg

Gjslick 10-27-2011 06:09 AM

Btw, you'll need ColdFusion 8 or higher for that.

-Greg


All times are GMT +1. The time now is 10:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.