Pauses the program for a certain number of seconds.
DELAY numeric expression
Remarks and Examples
The DELAY statement causes the program to pause for the number of seconds specified.
10 PRINT "Please wait for ten seconds." 20 DELAY 10 30 PRINT "OK, I'm back."
A fractional number of seconds is permitted: DELAY 0.5 will wait for half of one second. The smallest possible delay is one millisecond, i.e. one thousandth of a second (DELAY 0.001). DELAY statements with values less than 0.001 will not explicitly pause for any length of time (although the execution of the statement will consume some amount of time).
A program that is "stuck" on a lengthy delay can be interrupted using the Run | Break menu option.
10 FOR X = 1 TO 50000 : NEXT X
That has the disadvantage that the exact length of the delay is unpredictable. The delay would be shorter on faster computers, because a faster computer can count through the iterations faster. Using the DELAY statement ensures that the delay is the same, regardless of what speed of computer ReadyBASIC is running on.
Copyright 2006-2008, Kevin Matz, All Rights Reserved.