QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

SLEEP pauses the program indefinitely or for a specified number of seconds, program is unpaused when the user presses a key or when the specified number of seconds has passed.

Syntax

SLEEP [seconds]

Example(s)


CLS 
PRINT "Press a key..."
SLEEP
PRINT "You pressed a key, now wait for 2 seconds."
SLEEP 2
PRINT "You've waited for 2 seconds."
PRINT "(or you pressed a key)"


Press a key...
You pressed a key, now wait for 2 seconds.
You've waited for 2 seconds.
(or you pressed a key)

Explanation: SLEEP without any arguments waits until a key is pressed, next SLEEP statement uses the argument 2 which means that it will wait for 2 seconds, any number of seconds can be specified.

See Also