Skip to main content

Pause

Pause (Statement)​

Format​

pause numeric_expression
pause (numeric_expression)

Description​

Halts execution for the specified number of seconds. The value of seconds may be a decimal value, so sub-second precision is possible.

The wait is measured to a deadline, so pause never comes back early and is accurate to about a millisecond. Sleeping is not exact on any computer -- a busy machine can always hand the program back a little late -- but the lateness does not build up over a series of pauses, because each one is timed from when it started rather than from when the one before it finished.

A pause of zero or less does nothing at all. Any length up to a day is waited for.

Pressing the Stop button ends a program that is sitting in a pause straight away, rather than when the pause runs out.

To pace a drawing loop, use FrameRate rather than pause. pause waits for a length of time, so a loop ended with pause 1/60 takes one frame's drawing plus a sixtieth of a second and therefore always runs slower than sixty frames a second. FrameRate waits until the next frame is due, which takes the drawing time into account.

Example​

print "Starting the wait"
pause 0.5
print "Half a second later"

See Also​

Begin Case / Case / End Case, Call, Continue Do, Continue For, Continue While, Do / Until, End, Exit Do, Exit For, Exit While, For / Next, For Each / Next, FrameRate, Function, Global, Goto, Gosub, If Then, Msec, Pause, Ref, Rem, Return, Subroutine, While / End While

History​

2.2Waits to a deadline, so it is no longer short, and Stop interrupts it.