Skip to main content

For questions about the BASIC (Beginner’s All-purpose Symbolic Instruction Code) programming language. DO NOT USE TO INDICATE YOUR QUESTION IS SIMPLE!

BASIC, short for Beginner's All-purpose Symbolic Instruction Code, is a family of high-level programming languages popular in the 1980s, and emphasizes on the ease of use. This language and the tag is not to be confused with Visual Basic.

The first version of BASIC was developed on May 1st, 1964 by John G. Kemeny, Thomas E. Kurtz and Mary Kenneth Keller in Dartmouth College. Since then, it encouraged students and enthusiasts from backgrounds other than sciences and mathematics to create their own programs and many microcomputers of the 1980s came pre-loaded with BASIC. Later, many other programming languages heavily influenced by BASIC has been developed, with several still in use, such as Visual Basic and VB.NET.

Here is an example of a sample qBASIC program (one BASIC variety), which prints "Hello World", uses a for loop to print out number multipliers, then squares a number variable, asks for name input, and then repeatedly asks for number input until the user enters a negative number. The text after // are not part of the code.

10 PRINT "HELLO WORLD" // Hello World
20 FOR X=1 TO 5        // For Loop
30 PRINT "X "; X
40 NEXT X
50 LET A = 10          // Square variable
55 LET B = A*A
60 PRINT A;"^2 = ";B
70 PRINT "ENTER YOUR NAME"            // Enter name
75 INPUT "Enter your name:"; a$
80 PRINT "My name is "; a$
90 PRINT "ENTER A NUMBER, 0 TO CLOSE" // Repeatedly enter number
95 INPUT "Enter a number:"; a$
100 PRINT "The number is "; a$
110 IF a$ >= 0 THEN GOTO 90
999 END

An example output is:

HELLO WORLD
X 1
X 2
X 3
X 4
X 5
10^2 = 100
ENTER YOUR NAME
My name is I am a basic programmer!
ENTER A NUMBER, 0 TO CLOSE
The number is 5
ENTER A NUMBER, 0 TO CLOSE
The number is 4
ENTER A NUMBER, 0 TO CLOSE
The number is 3
ENTER A NUMBER, 0 TO CLOSE
The number is 2
ENTER A NUMBER, 0 TO CLOSE
The number is 1
ENTER A NUMBER, 0 TO CLOSE
The number is 0
ENTER A NUMBER, 0 TO CLOSE
The number is -1

Read More

  • Visual Basic for Applications, usually for writing macros for Microsoft Office.
  • One of the main languages of the .NET Framework. It is not the same as VBA.
  • Wikipedia
  • Online BASIC simulator