Language reference

See the Download section for offline help text.

BASIC is a very simple language and it is a perfect tool for calculations or utilities. Its name stands for (B)eginners (A)ll-purpose (S)ymbolic (I)nstruction ©ode. It was developed by John Kemeny and Thomas Kurtz at Dartmouth College during the middle of 1960, and was one of the most popular languages for several decades.

How to read the language reference syntax

  • Everything written inside of [ ] characters are optional values.
  • Everything written inside of { characters means you must select one of them.
  • The symbol | means OR.
  • The symbols ... mean you can repeat the previous syntax.
  • Keywords are written with capital letters.
  • Parameters are written with lower letters.
  • Keywords with suffix ( ) are functions.
  • Parameters with suffix ( ) are arrays.
FOO     <- This is keyword
FOO()   <- This is function
foo     <- This is variable/parameter
foo()   <- This is array/parameter
{A|B}   <- This means that you must type A or B
[{A|B}] <- This means that you must use A or B or nothing

The following example means that you must give the first parameter (a) but you can use the second (x) only if you want to. But if you want to use the (x) you must also separate it from (a) with a comma.

FOO a[, x]

The next example means that you must use the first parameter. You can also use second parameter but you must separate it with ‘,’ or ‘;’. You can also repeat the last syntax more times.

FOO var [{,|;} var2 [...]]

The following code demonstrates valid examples of this syntax:

FOO a
FOO a, b
FOO a; b
FOO a, b; c
FOO a, b, c
FOO a; b; c, d; e, f, g

Index

? ! ~ ABS ABSMAX ABSMIN ACCESS ACOS ACOSH ACOT ACOTH ACSC ACSCH AND APPEND ARC ASC ASEC ASECH ASIN ASINH AT ATAN ATAN2 ATANH ATN BAND BCS BEEP BGETC BIN BLOAD BOR BPUTC BSAVE BYREF CALL CASE CAT CBS CDBL CEIL CHAIN CHART CHDIR CHMOD CHOP CHR CINT CIRCLE CLOSE CLS COLOR CONST COPY COS COSH COT COTH CREAL CSC CSCH DATA DATE DATEDMY DATEFMT DEF DEFINEKEY DEG DELAY DELETE DERIV DETERM DIFFEQN DIM DIRWALK DISCLOSE DO FORM DRAW DRAWPOLY ELIF ELSE ELSEIF EMPTY ENCLOSE END ENDIF ENV ENV EOF ERASE EQV EXEC EXIST EXIT EXP EXPORT EXPRSEQ FI FILES FIX FLOOR FOR FORMAT FRAC FRE FREEFILE FUNC GOSUB GOTO HEX IF IFF IMAGE IMP IMPORT IN INKEY INPUT INPUT INPUT INSERT INSTR INT INTERSECT INVERSE ISARRAY ISDIR ISFILE ISLINK ISNUMBER ISSTRING JOIN JULIAN KILL LABEL LINEINPUT LINPUT LBOUND LCASE LEFT LEFTOF LEFTOFLAST LEN LET LIKE LINE LINEQN LOCAL LOCATE LOCK LOF LOG LOG10 LOGPRINT LOWER LTRIM M3APPLY M3IDENT M3ROTATE M3SCALE M3TRANS MAX MDL MID MIN MKDIR MOD NAND NEXT NOR NOSOUND NOT OCT ON OR OPEN OPTION PAINT PAUSE PEN PEN PLAY PLOT POINT POLYAREA POLYCENT POLYEXT POW PRINT PROGLINE PSET PTDISTLN PTDISTSEG PTSIGN RAD RANDOMIZE READ RECT REDIM REM RENAME REPEAT REPLACE RESTORE RETURN RGB RGBF RIGHT RIGHTOF RIGHTOFLAST RINSTR RMDIR RND ROOT ROUND THROW RTRIM RUN SEARCH SEC SECH SEEK SEEK SEGCOS SEGLEN SEGSIN SELECT SEQ SGN SIN SINH SINPUT SORT SOUND SPACE SPC SPLIT SPRINT SQUEEZE SQR STATMEAN STATMEANDEV STATSPREADP STATSPREADS STEP STKDUMP STOP STR STRING SUM SUMSQ SWAP SUB TAB TAN TANH TEXTHEIGHT TEXTWIDTH THEN TICKS TIME TIMEHMS TIMER TIMESTAMP TLOAD TRANSLATE TRIM TROFF TRON TSAVE TXTH TXTW UBOUND UCASE UNIT UNTIL UPPER USE VAL VIEW WEEKDAY WEND WHILE WINDOW WRITE XOR XPOS XNOR YPOS

Index by Module

Comments

You can find:

escape codes under Console or under Articles "Escape Codes"

ARRAY under Data
ISMAP under Data
ISREF under Data

bit color systems under Graphics
STEP under Graphics
aspect under Graphics
FILLED under Graphics
QBcolors under COLOR under Graphics

"system variables" AKA built in coder constants under System eg, pi, xmax, ymax, cwd...
INCLUDE under System

Allot of information is under Articles > "Welcome to SmallBASIC":
operators eg ~ % ^ ! IN LIKE
special characters eg [ , ;] ARRAY definition << append to array
basic stuff about variables, subs and functions
aha! stuff on units, meta commands, options, pseudo operators