BASIC (programming language)
BASIC is an acronym for Beginners All-purpose Symbolic Instruction Code. It is a Programming Language invented at Dartmouth College in 1964 by mathematicians John George Kemeny and Thomas E. Kurtz for the purpose of teaching elementary programming. BASIC has since been defined in two ANSI (X3.60-1978 and X3.113-1987) and two ISO (6373:1984 and ISO/IEC 10279:1991) standards. Its simplicity has led to widespread use; interpreters and compilers exist for variants of BASIC on nearly every hardware platform in existence, but the most popular commercial version is Microsoft's Visual BASIC.
The original BASIC supported single-character variable names (or a single character followed by a single digit) of type real. Arrays and matricies are also supported. Statements: DATA, DEF, DIM, END, FOR...NEXT, GOSUB, GOTO, IF...THEN, LET, MAT, PRINT, READ, REM, RETURN, STOP Functions: ABS, ATN, COS, EXP, INT, LOG, RND, SIN, SQR, TAN Operators: + - / * ^ ( )
One of the most noticeable items in BASIC programs are the line numbers, which define the order in which the program is executed. Line numbers are supported, but not required in most modern versions of BASIC.
The original BASIC implementation was a compiler, but for many years most BASIC implementations were interpreters (either straight interpreters or byte-code interpreters).
The following is a small sample program written in BASIC:
1 REM Sample program
10 PRINT " This program will pick a number between 1 and 100, inclusive."
20 PRINT "Try to pick the number in the smallest number of guesses possible."
40 LET V = INT( RND( 0 ) * 100 ) + 1
50 LET C = 0
60 PRINT "Your guess";
70 INPUT G
80 LET C = C + 1
90 IF G = V THEN GOTO 150
100 IF G < V THEN GOTO 130
110 PRINT "Your guess is high."
120 GOTO 60
130 PRINT "Your guess is low."
140 GOTO 60
150 PRINT "You guessed it in "; C; " guesses."
160 GOTO 40