Thus, SPEED 10 will slow things down to about 10 characters per second. In addition, the SPEED command allows you to specify the teletype speed, for a more realistic simulation. (Like the commands, the system names may be abbreviated to three letters.) If not, the operating system will ask you for a system name. The SYSTEM command may be followed by either BASIC or ALGOL. If not, the operating system will ask you for the name of the program. The NEW, OLD, and RENAME commands may be followed by a program name. SYSTEM Name the system - limited to either BASIC (default) or ALGOLĪll commands may be abbreviated to the first three letters. UNSAVE Unsave the current program program STOP Stop the current run of the program (in case an infinite loop) REPLACE Save the current program to storage, overwriting older versionĬAT List the names of your saved programs (short for CATALOG) HELLO Start a new session, enter your user number Example Programsġ20 DEF FNN(X) = EXP(-(X^2/2))/SQR(2*3.14159265)ġ20 PRINT "GUESS THE NUMBER BETWEEN 1 AND 100."ģ00 PRINT "YOU GUESSED IT, IN" N "TRIES"ģ10 PRINT "ANOTHER GAME (YES = 1, NO = 0)" Īlthough not part of BASIC, the commands of the operating system include the following: The expression should contain an X unless the function value does not depend upon an argument the expression may contain other variables from the program.ĭEF statement may appear anywhere in the program before the END statement. The function definition must be a single line with the following form: The variable name used as an argument is distinct from the variable with the same name in the rest of the program. Each such function is introduced by the DEF keyword. The user may define up to 26 new functions, giving them names from FNA to FNZ. If the material on the printed line exceeds 75 characters, an end-of-line is automatically introduced. If a quoted string and a numeric value are separated by a semicolon in the PRINT statement, the semicolon may be omitted. While there is no string data type, quoted strings are allowed in PRINT statements. Furthermore, numeric values will always produce a number of characters that is a multiple of three. Thus, numerical values in a PRINT statement with semicolons as separators will have at least one space between values. Numerical values are printed with either a leading space or a minus sign, and with a trailing space. If by semicolons, BASIC does not move but starts the next item at the next space. If by commas, BASIC moves to the start of the next zone. The PRINT statement allows several quantities, including quoted strings, separated by commas (,) or semicolons ( ). The DIM statement allows other upper limits, but the zero element is always provided. Without a DIM statement, the default dimensions are 0 to 10 for each dimension. ArraysĪ single letter followed by a “(“ denotes an array element, which may be one or two-dimensional. This provides for 286 possible variable names.
Variable names can be a single letter, or a single letter followed by a single digit. The RND function needed a dummy argument to get past the syntax scanner.
INT The integer part (truncating toward 0)Īrguments for SIN, COS, TAN, and the value from the ATN, are assumed to be in radians.Įrror messages are given for arguments out of range for the LOG and SQR functions, although SQR then provides the SQR of the absolute value. In the GE-225 and GE-235, this meant a precision of about 30 bits (roughly ten digits) with an base 2 exponent range of -256 to +255. That isĪll arithmetic was done in floating point. There is one anomoly: a leading minus sign is treated as unary, and has higher precedence that exponentiation, which is contrary to the usual practive. (a - b - c) is understood to be the same as ((a - b) - c) Left-association is used for multiple operations within a group.
Normal precedence rules are used: Exponentiation, multiply and divide, add and subtract. Arithmetic Expressionsīesides the four standard arithmetic operations, BASIC includes raising-to-the-power, the symbol of which is “^”. In addition, the slightly more recent version of BASIC that we are using includes the INPUT statement. RETURN Returns from the end of the subroutineĭEF Introduces programmer-defined functions GOTO Does just that, transfers to another line-numbered statement READ Assigns values to variables from internal data LET Introduces the assignment statement, and is required There were fifteen statement types in the original BASIC. This note gives an outline of the language for those of you familiar with programming. This document is reproduced courtesy of Thomas Kurtz The Original-Original Versionĭartmouth BASIC revolutionized computer programming for the non-experts, who greatly outnumber the experts! It was a simple language, used English words, and gave almost instantaneous response in the days when turnarounds of hours or even days was the norm.