Appendices
Syntax cheat sheet (QB64-PE), keywords (QBasic core), built-in functions reference, dialect comparison, history & versions, learning resources and suggested study plan (12 weeks).
Appendices
42.1 Syntax cheat sheet (QB64-PE) 42.2 Keywords (QBasic core)
ABS ACCESS AND ANY APPEND AS ASC ATN BASE BEEP BINARY BLOAD BSAVE BYVAL CALL CASE CDBL CHAIN CHDIR CHR$ CINT CIRCLE CLEAR CLNG CLOSE CLS COLOR COM COMMAND$ COMMON CONST COS CSNG CSRLIN CVD CVI CVL CVS DATA DATE$ DECLARE DEF DEFDBL DEFINT DEFLNG DEFSNG DEFSTR DIM DO DOUBLE DRAW ELSE ELSEIF END ENVIRON ENVIRON$ EOF EQV ERASE ERDEV ERL ERR ERROR EXIT EXP FIELD FILEATTR FILES FIX FOR FRE FREEFILE FUNCTION GET GOSUB GOTO HEX$ IF IMP INKEY$ INP INPUT INPUT$ INSTR INT INTEGER IOCTL IS KEY KILL LBOUND LCASE$ LEFT$ LEN LET LINE LOC LOCATE LOCK LOF LOG LONG LOOP LPOS LPRINT LSET LTRIM$ MID$ MKD$ MKDIR MKI$ MKL$ MKS$ MOD NAME NEXT NOT OCT$ OFF ON OPEN OPTION OR OUT OUTPUT PAINT PALETTE PCOPY PEEK PEN PLAY PMAP POINT POKE POS PRESET PRINT PSET PUT RANDOM RANDOMIZE READ REDIM REM RESET RESTORE RESUME RETURN RIGHT$ RMDIR RND RSET RTRIM$ RUN SCREEN SEEK SELECT SGN SHARED SHELL SIN SINGLE SLEEP SOUND SPACE$ SPC SQR STATIC STEP STICK STOP STR$ STRIG STRING STRING$ SUB SWAP SYSTEM TAB TAN THEN TIME$ TIMER TO TROFF TRON TYPE UBOUND UCASE$ UNLOCK UNTIL USING VAL VARPTR VARPTR$ VARSEG VIEW WAIT WEND WHILE WIDTH WINDOW WRITE XOR
Selected QB64-PE extensions: _NEWIMAGE _LOADIMAGE _PUTIMAGE _FREEIMAGE _COPYIMAGE _DEST _SOURCE _DISPLAY _AUTODISPLAY _LIMIT _DELAY _RGB _RGB32 _RGBA32 _RED32 _GREEN32 _BLUE32 _ALPHA32 _CLEARCOLOR _PRINTSTRING _PRINTMODE _LOADFONT _FONT _TITLE _FULLSCREEN _SCREENMOVE _WIDTH _HEIGHT _KEYHIT _KEYDOWN _KEYCLEAR _MOUSEINPUT _MOUSEX _MOUSEY _MOUSEBUTTON _MOUSEWHEEL _SNDOPEN _SNDPLAY _SNDLOOP _SNDSTOP _SNDVOL _SNDCLOSE _SNDRAW _SNDRATE _MEM _MEMNEW _MEMGET _MEMPUT _MEMFREE _MEMIMAGE _OFFSET _UNSIGNED _BYTE _BIT _INTEGER64 _FLOAT _DEFINE _PRESERVE _CONTINUE _TRIM$ _INSTRREV _PI _ATAN2 _HYPOT _CEIL _ROUND _D2R _R2D _SHL _SHR _ANDALSO _ORELSE _FILEEXISTS _DIREXISTS _STARTDIR$ _CWD$ _COMMANDCOUNT _CLIPBOARD$ _OS$ _EXIT _ECHO _ASSERT _ERRORLINE _OPENCLIENT _OPENHOST _OPENCONNECTION _DEVICES _BUTTON _AXIS 42.3 Built-in functions reference
ABS SGN SQR EXP LOG SIN COS TAN ATN INT FIX CINT CLNG CSNG CDBL RND _PI _ATAN2 _ACOS _ASIN _HYPOT _CEIL _ROUND _D2R _R2D
LEN LEFT$ RIGHT$ MID$ INSTR _INSTRREV UCASE$ LCASE$ LTRIM$ RTRIM$ _TRIM$ STR$ VAL CHR$ ASC SPACE$ STRING$ HEX$ OCT$ INPUT$ Conversion (binary) MKI$ MKL$ MKS$ MKD$ CVI CVL CVS CVD
LBOUND UBOUND (statements: DIM REDIM ERASE SWAP) EOF LOF LOC SEEK FREEFILE _FILEEXISTS _DIREXISTS
CSRLIN POS POINT PMAP SCREEN() _WIDTH _HEIGHT _PRINTWIDTH INKEY$ _KEYHIT _KEYDOWN _MOUSEINPUT _MOUSEX _MOUSEY _MOUSEBUTTON _MOUSEWHEEL STICK STRIG
TIMER DATE$ TIME$ COMMAND$ _COMMANDCOUNT ENVIRON$ _OS$ _CLIPBOARD$ _STARTDIR$ _CWD$ _EXIT ERR ERL _ERRORLINE
PEEK VARPTR VARSEG SADD FRE _MEM _MEMNEW _MEMIMAGE _MEMGET _OFFSET Color & images
_RGB _RGB32 _RGBA32 _RED32 _GREEN32 _BLUE32 _ALPHA32 _NEWIMAGE _LOADIMAGE _COPYIMAGE _LOADFONT
_SNDOPEN _SNDPLAYING _SNDLEN _SNDGETPOS _SNDCOPY _SNDRATE _SNDRAWLEN 42.4 Dialect comparison Classic (GW-BASIC) FreeBASIC (-lang fb) -lang qb only implicit or OPTION _EXPLICIT Option Explicit On (default) Option Explicit recommended 16-bit INTEGER GOSUB, DEF FN SUB, FUNCTION Sub, Function, overloading methods, lambdas Sub, Function by value (numbers) Type with methods Structure, Class Type, class modules yes (single inheritance, virtual, abstract) limited (classes, interfaces, no inheritance) _MEM, _OFFSET no (IntPtr interop) VarPtr/ObjPtr (unofficial) ON ERROR GOTO return codes, On Error in qb modes On Error GoTo SCREEN, LINE, CIRCLE legacy + 32-bit images, fonts, hardware images fbgfx, libraries charts, shapes SOUND, PLAY SOUND, PLAY, _SND* SoundPlayer, libraries yes (Task, Async) Windows, Linux, macOS Windows, Linux, DOS, others Windows, macOS (Office) native (via C++) interpreted in Office 42.5 History & versions
Dartmouth BASIC (Kemeny & Kurtz) runs on 1 May on the GE-225 time-sharing system
Minicomputer and time-sharing BASICs (DEC BASIC-PLUS, HP Time-Shared BASIC) David Ahl's *101 BASIC Computer Games*
Altair BASIC (Gates, Allen, Davidoff) — Microsoft's first product; Tiny BASIC movement
Apple II (Integer BASIC; Applesoft later), Commodore PET, TRS-80 ANSI Minimal BASIC standard (X3.60)
BBC BASIC (Acorn BBC Micro); IBM PC with Cassette BASIC / BASICA
Commodore 64 (BASIC V2), ZX Spectrum (Sinclair BASIC) GW-BASIC for MS-DOS PCs QuickBASIC 1.0; True BASIC ANSI Full BASIC standard (X3.113)
QBasic ships with MS-DOS 5.0; Visual Basic 1.0 VBA in Excel 5.0 Visual Basic 6.0; PureBasic; REALbasic Gambas development begins Visual Basic.NET (.NET Framework 1.0) FreeBASIC first releases; BlitzMax QB64 project begins Microsoft Small Basic Basic4android (later B4X) REALbasic renamed Xojo
GW-BASIC source published by Microsoft; VB.NET declared a stable language on modern .NET
QB64 Phoenix Edition fork continues QB64 development 42.6 Learning resources Online (free):
QB64 Phoenix Edition wiki and forum (qb64phoenix.com) — complete keyword reference with examples
Terry Ritchie's QB64 game programming tutorial (qb64sourcecode.com)
FreeBASIC manual and community forum (freebasic.net) Microsoft Learn: Visual Basic documentation and VBA reference (learn.microsoft.com)
Microsoft Small Basic website — online IDE, tutorials, and curriculum
*BASIC Computer Games* modernized in many languages (GitHub: coding-horror/basic-computer-games)
Pete's QBasic / QB64 site (petesqbsite.com) — archived tutorials and the *QB Express* magazine
BBC BASIC for SDL 2.0 documentation (bbcbasic.co.uk) PC-BASIC (robhagemans.github.io/pcbasic) for running GW-BASIC programs
*Back to BASIC: The History, Corruption, and Future of the Language* — John G. Kemeny & Thomas E. Kurtz *BASIC Computer Games* — David H. Ahl
*QBasic Programming for Dummies* — Douglas Hergert *A Beginner's Guide to FreeBASIC* — Richard D. Clark
*Microsoft Visual Basic Step by Step* — Michael Halvorson (several editions)
*Excel VBA Programming For Dummies* — Michael Alexander & John Walkenbach
*Excel Power Programming with VBA* — Michael Alexander & Dick Kusleika
Community: QB64-PE forum and Discord, FreeBASIC forum, r/qbasic, r/visualbasic, r/vba, Stack Overflow (qbasic, qb64, freebasic, vb.net, vba tags), retro-computing communities (Lemon64, World of Spectrum, Stardot) 42.7 Suggested study plan (12 weeks)
History, install QB64-PE and FreeBASIC, first programs Classic BASIC, variables and types, operators
Console I/O, decisions, loops — Part I exercises SUBs, FUNCTIONs, scope, recursion — Capstone Project 1 Arrays, TYPEs, strings
Math, DATA, error handling, files, structured style — Part II exercises, Project 2 Graphics (legacy and modern), sound Input, timing, game loops — Project 4
Algorithms, data structures, memory — Project 3 Modular programs, system access, debugging — Part III exercises, Project 5 or 6
FreeBASIC OOP, VB.NET, VBA, Small Basic — Project 8 Other dialects, porting, complete projects, best practices — Project 7 🎓 Final Words
BASIC began in 1964 with a radical idea: programming should be for everyone. You've followed that idea from Dartmouth's teletypes and the line-numbered listings of the home-computer era through structured QBasic, QB64-PE graphics and game loops, file formats, algorithms, and memory blocks, to FreeBASIC objects, VB.NET classes and LINQ, and VBA automating spreadsheets. The dialects differ, but the skills — breaking problems into procedures, choosing good data structures, handling errors, and testing carefully — are the same in every language you will ever learn. Build the capstone projects, port an old listing or two, share your programs with the community, and keep the spirit of BASIC alive: start simple, experiment freely, and have fun. Happy coding! 💾
OPTION _EXPLICIT ' require declarations
CONST MAX = 100 ' constant
TYPE Point2: x AS SINGLE: y AS SINGLE: END TYPE
DIM n AS LONG, s AS STRING, p AS Point2 ' variables
DIM a(1 TO 10) AS INTEGER ' array
REDIM b(0) AS STRING: REDIM _PRESERVE b(1 TO 5) AS STRING
DIM SHARED gScore AS LONG ' global
PRINT "x ="; x; TAB(20); s ' output
PRINT USING "###.##"; 3.14159
INPUT "Prompt: ", n: LINE INPUT "Text: "; s
CLS: LOCATE row, col: COLOR fg, bg
IF n > 0 THEN ... ELSEIF n < 0 THEN ... ELSE ... END IF
SELECT CASE n: CASE 1, 2: ...: CASE 3 TO 9: ...: CASE IS > 9: ...: CASE ELSE: ...: END SELECT
FOR i = 1 TO 10 STEP 2: ... : NEXT
DO WHILE cond: ...: LOOP DO: ...: LOOP UNTIL cond
WHILE cond: ...: WEND EXIT FOR / EXIT DO / _CONTINUE
SUB Name (arg AS LONG): ...: END SUB ' call: Name 5 or CALL Name(5)
FUNCTION Twice& (v AS LONG): Twice& = v * 2: END FUNCTION
OPEN f$ FOR INPUT AS #1: LINE INPUT #1, t$: CLOSE #1 ' also OUTPUT, APPEND, BINARY, RANDOM
ON ERROR GOTO Handler ... Handler: PRINT ERR: RESUME NEXT
SCREEN _NEWIMAGE(800, 600, 32): _TITLE "Game"
LINE (x1, y
…