BASIC

BASIC (Beginner's All-purpose Symbolic Instruction Code) was designed in 1964 at Dartmouth so that students outside science and engineering could program. In its classic form a program is a list of numbered lines, run in order, with GOTO and GOSUB as the only way to change the flow.

Paradigm: Linear Programming

What Makes BASIC Special

  • Line numbers are the structure. Every statement has a number. The interpreter runs them in ascending order, and GOTO 80 means literally "continue at line 80". There are no blocks or indentation rules.
  • Interactive by design. You type a line, press Enter, and it is stored. Type RUN and it executes. The edit-run loop was instant, decades before IDEs.
  • Jumps instead of blocks. GOTO jumps to a line, GOSUB/RETURN calls a shared routine. This is why classic BASIC is the textbook linear language, and why large programs became "spaghetti".
  • Global variables only. In early dialects every variable is global and a name like A$ marks a string. Simple to learn, hard to scale.
  • It evolved. Later dialects (QBasic, Visual Basic, FreeBASIC) dropped line numbers and added SUB, WHILE and classes, moving into structured and object-oriented styles.

Example: Guess the number

10 REM Guess the number
20 LET SECRET = 42
30 INPUT "Your guess"; G
40 IF G = SECRET THEN GOTO 80
50 IF G < SECRET THEN PRINT "Too low" ELSE PRINT "Too high"
60 GOTO 30
80 PRINT "Correct!"
90 END

How It Works

  • Lines 10-30 run top to bottom: a remark, an assignment, and keyboard input.
  • Line 40 is the only decision: when the guess matches, jump forward to line 80.
  • Line 60 jumps backward to line 30. That single jump is the loop; the language has no loop statement.
  • Line 80 is reached only by the jump on line 40, so gaps in numbering (70 is missing) leave room to insert code later.

History and Where It Is Used

BASIC shipped in the ROM of home computers in the 1970s and 1980s (Apple II, Commodore 64, ZX Spectrum) and Microsoft's first product was a BASIC interpreter. Today it lives on in Visual Basic, VBA in Office, and hobby compilers such as FreeBASIC. It remains a good way to see, with nothing in the way, how a program is just a sequence of lines.

Learn More