QBasic 1.1: ON TIMER Statement

Syntax

TIMER ON
TIMER OFF
TIMER STOP
ON TIMER(n%) GOSUB line

Description / Parameter(s)

TIMER ON Enables timer event trapping.
TIMER OFF Disables timer event trapping.
TIMER STOP Suspends timer event trapping. Events are processed once event trapping is enabled by TIMER ON.
n% The number of seconds that elapse before ON TIMER branches to the event-trapping subroutine; a value in the range 1 through 86,400 (24 hours).
line The label or number of the first line of the event-trapping subroutine.

Example

ON TIMER(1) GOSUB TimeUpdate TIMER ON CLS PRINT "Time: "; TIME$ StartTime = TIMER WHILE TimePast < 10 TimePast = TIMER - StartTime WEND END TimeUpdate: LOCATE 1, 7: PRINT TIME$ RETURN