GW-BASIC was a dialect of the programming language BASIC developed by Microsoft from BASICA, originally for Compaq. It is compatible with Microsoft/IBM BASICA, but was disk based and did not need the ROM BASIC. It was bundled with MS-DOS operating systems on IBM PC compatibles by Microsoft. Microsoft also sold a BASIC compiler, BASCOM, compatible with GW-BASIC, for programs needing more speed. The language was suitable for simple games, business programs and the like. Since it was included with most versions of MS-DOS, it was also a low cost way for many would-be programmers to learn the fundamentals of computer programming. With the release of MS-DOS 5.0, GW-BASIC's place was eventually taken by QBasic, a cut-down version of the separately available QuickBASIC compiler.
GW-BASIC has a command line-based integrated development environment (IDE) based on Dartmouth BASIC. It also includes function key shortcuts at the bottom of the screen. Like other early microcomputer versions of BASIC, GW-BASIC lacked many of the structures needed for structured programming such as local variables, and GW-BASIC programs executed relatively slowly, due to the fact that it was an interpreted programming language. All program lines must be numbered; all non-numbered lines are considered to be commands in direct mode to be executed immediately. Program source files are normally saved in binary compressed format with tokens replacing commands, with an option to save in ASCII text form.
The GW-BASIC command-line environment has commands to
RUN,LOAD,SAVE,LIST the current program, or quit to the operating
SYSTEM; these commands can also be used as program statements. There is little support for structured programming in GW-BASIC. All
IF/THEN/ELSE conditional statements must be written on one line, although
WHILE/WEND statements may group multiple lines. Functions can only be defined using the single line
DEF FNf(x)=<mathematical function of x> statement (e.g.,
DEF FNLOG(base,number)=LOG(number)/LOG(base)). The data type of variables can be specified with a character at the end of the variable name:
A$ is a string of characters,
A% is an integer, etc. Groups of variables can also be set to default types based on the initial letter of their name by use of the
DEFINT, DEFSTR, etc., statements. The default type for undeclared variables not identified by such typing statements, is single-precision floating point.
Full article ▸