# SLEEP

Updated: 11/30/2021, 7:00:45 PM
Created: 11/30/2021, 7:00:45 PM
Last Updated By: Jake Tuttle
Read Time: 1 minute(s)

# Description

Sleep allows the program to pause execution for a specified period. It takes the general form:

SLEEP {expression}
1

Where:

expression may evaluate to either a numeric, in which case the program will sleep for the specified number of seconds, or fractions of a second "nn:nn{:nn}", in which case the program will sleep until the time specified.

If expression is not supplied then a default period of 1 second is assumed.

# Note

Sleeping until a specified time works by calculating the time between the current time and the time supplied and sleeping for that many seconds. If in the meantime the host clock is changed the program will not wake up at the desired time;

If invoking the debugger while a program is sleeping and the execution continued, the user will be prompted:

Continue with SLEEP (Y/N)?

If "N" is the response, the program will continue at the next statement after the SLEEP.

Examples of use would be as:

*Sleep until the end of the working day
SLEEP "17:30”

* 40 winks...
SLEEP 40

* Sleep for two and a half seconds...
SLEEP 2.5
1
2
3
4
5
6
7
8

See also: MSLEEP.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide