CSC 180.1 · Introduction to Computer Science and BASIC Programming
Our notes
2 min readWhat BASIC is
BASIC (Beginner's All-purpose Symbolic Instruction Code) was created in 1964 by John Kemeny and Thomas Kurtz at Dartmouth College for beginners. Later versions: GW-BASIC, QBasic, Visual Basic, FreeBASIC.
Languages and translators
- Machine language: binary, understood directly by the CPU.
- Assembly language: short codes (mnemonics), translated by an assembler.
- High-level languages (BASIC, FORTRAN, C, Python): English-like, translated by a compiler (whole program at once into machine code) or an interpreter (line by line as it runs). Classic BASIC is usually interpreted.
Structure of a classic BASIC program
10 REM AREA OF A RECTANGLE
20 INPUT "LENGTH, WIDTH"; L, W
30 LET A = L * W
40 PRINT "AREA ="; A
50 END
With L = 5 and W = 3 it prints AREA = 15.
Rules for writing BASIC statements
- Each line starts with a line number (often 10, 20, 30... so lines can be inserted later). Lines run in number order.
- One statement per line (or several separated by colons in many dialects).
- Each statement starts with a keyword: REM, LET, INPUT, PRINT, READ, DATA, IF, GOTO, FOR, NEXT, GOSUB, RETURN, DIM, END, STOP.
- Keywords cannot be used as variable names.
- END is the last line.
- Strings are written in double quotes.
System commands (not part of the program)
RUN (execute), LIST (show the program), NEW (clear it), SAVE and LOAD (files), and in some versions EDIT, DELETE and RENUM.
Kinds of errors
- Syntax error: breaks the language rules (PRNT, missing quote). The translator reports it.
- Run-time error: occurs while running (division by zero, "out of DATA").
- Logic error: the program runs but gives wrong answers (wrong formula). Found by testing and tracing.
Exams usually ask
- What do the letters BASIC stand for? Who developed it and when?
- State the rules for writing a BASIC program.
- Distinguish compiler from interpreter and syntax from logic errors.
Common mistake
Writing a program with line numbers out of the intended order. BASIC sorts lines by number, so line 25 runs between 20 and 30 whatever order you typed them.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick BASIC
(opens en.wikipedia.org in a new tab)
Wikipedia, BASIC, CC BY-SA 4.0 · licence
-
QBasic
(opens en.wikipedia.org in a new tab)
Wikipedia, QBasic, CC BY-SA 4.0 · licence
-
GW-BASIC
(opens en.wikipedia.org in a new tab)
Wikipedia, GW-BASIC, CC BY-SA 4.0 · licence
-
NOUN CIT 132: Programming in BASIC
NOUN course book (PDF, about 0.8 MB). The whole BASIC programming course.
(opens nou.edu.ng in a new tab)
Watch
-
QB64 Basic programming tutorial
10 min · ≈ 45 MB · about ₦25
(opens youtube.com in a new tab)
-
QBasic Tutorial 1 - Getting Started - Free Download - QB64 - Program 1 Hello World - Download Link
6 min · ≈ 27 MB · about ₦15
(opens youtube.com in a new tab)
-
QBASIC Programming Tutorial Lesson 1
5 min · ≈ 23 MB · about ₦13
(opens youtube.com in a new tab)
-
The basics of QBASIC - Lesson 1 Comments, variables and simple printing
11 min · ≈ 50 MB · about ₦28
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.