SLEEP statement

Syntax

SLEEP [seconds]

Description

Use the SLEEP statement to suspend execution of a BASIC program, pausing for a specified number of seconds.

seconds is an expression evaluating to the number of seconds for the pause. If seconds is not specified, a value of 1 is used. If seconds evaluates to the null value, it is ignored and 1 is used.

Example

In the following example the program pauses for three seconds before executing the statement after the SLEEP statement. The EXECUTE statement clears the screen.

PRINT "STUDY THE FOLLOWING SENTENCE CLOSELY:"
PRINT
PRINT
PRINT "There are many books in the"
PRINT "the library."
SLEEP 3
EXECUTE 'CS'
PRINT "DID YOU SEE THE MISTAKE?"

This is the program output:

STUDY THE FOLLOWING SENTENCE CLOSELY:


There are many books in the
the library.
DID YOU SEE THE MISTAKE?