QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _LIMIT statement sets the loop repeat rate of a program to so many per second, relinquishing spare CPU cycles to other applications.

Syntax

_LIMIT framesPerSecond!

Example(s)

Limits loop execution to 30 frames per second and limits the program’s CPU usage.


PRINT "To Quit press ESC key!"
DO
   _LIMIT 30
   PRINT CHR$(26);
   IF INKEY$ = CHR$(27) THEN EXIT DO 
LOOP 


To Quit press ESC key!
→→→→→→→→→→→→→→→→→→→→

Note: In the above example, _LIMIT has to be within the loop.

See Also