ON TIMER

Previous  Next

 

ON TIMER GOTO label

 


 

Use this together with the TIMER statement to implement a periodic timer.  Each time the timer expires, the program will jump to the specified label.  Use RESUME NEXT to resume at the next statement where the timer interrupted the execution.

 

Example:

 

ON TIMER GOTO _Timer

 

' Activate timer routine every second

TIMER 1

 

' Print 100 messages, one every 10th of a second

FOR i = 1 TO 100

  SLEEP( 0.1 )

  PRINT "Kalle... ";i,

NEXT i

 

_Done:

' Disable timer

TIMER 0

 

END

 

' Timer Routine

_Timer:

  PRINT "Timer Kicked In !",

  RESUME NEXT