Skip to content

Sleep

Purpose

To pause execution of the DataFlex program for a specified time interval.

Syntax

sleep
seconds

Argument Explanation

  • seconds: May be of any class and any type except String.

What It Does

Sleep pauses all activity in the program for the number of seconds specified by the value of seconds.

send bell
move 3 to iDuration
sleep iDuration

In this example, the computer's bell is rung, and 3 is moved to the integer variable iDuration. The subsequent sleep command pauses program execution for 3 seconds.

Sleep is particularly useful to keep messages and warnings visible on the screen long enough for users to read them. It reads the system clock and thus is not affected by the speed of the computer the program is being run on.

Notes

  • Sleep cannot be interrupted by user input.
  • Sleep does not offer timing to fractions of a second. If seconds contains a decimal portion, that portion of the value will be truncated when the command is executed.