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.

INTEGER is a 2-byte number type definition that can hold whole numerical values.

Syntax

DIM variable AS INTEGER

Example(s)

QBasic signed integers were limited from -32768 to 32767, but could not exceed 32767 or it would error:


DO: _LIMIT 2000
  i% = i% + 1
  PRINT i%
LOOP UNTIL i% = 0 

Explanation: In QB64 the count will go to 32767, then count up from -32768 to 0 before repeating the process without error.

When a signed QB64 INTEGER value exceeds 32767, the value may become a negative value:


i% = 38000
PRINT i% 


-27536

Explanation: Use an _UNSIGNED INTEGER or a ~% variable type suffix for only positive integer values up to 65535.

In QB64 _UNSIGNED INTEGER values greater than 65535 cycle over again from zero:


i~% = 70000
PRINT i~% 


 4464

Explanation: In QB64 an unsigned integer value of 65536 would be 0 with values increasing by the value minus 65536.

See Also