BASIC
Encyclopedia
BASIC is a family of general-purpose
General-purpose programming language
In computer software a general-purpose programming language is a programming language designed to be used for writing software in a wide variety of application domains...

, high-level programming language
High-level programming language
A high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be from the specification of the program, making the process of...

s whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code.

The original Dartmouth BASIC
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It is so named because it was designed and implemented at Dartmouth College...

 was designed in 1964 by John George Kemeny
John George Kemeny
John George Kemeny was a Hungarian American mathematician, computer scientist, and educator best known for co-developing the BASIC programming language in 1964 with Thomas E. Kurtz. Kemeny served as the 13th President of Dartmouth College from 1970 to 1981 and pioneered the use of computers in...

 and Thomas Eugene Kurtz
Thomas Eugene Kurtz
Thomas Eugene Kurtz is an American computer scientist who co-developed the BASIC programming language during 1963 to 1964, together with John G. Kemeny....

 at Dartmouth College
Dartmouth College
Dartmouth College is a private, Ivy League university in Hanover, New Hampshire, United States. The institution comprises a liberal arts college, Dartmouth Medical School, Thayer School of Engineering, and the Tuck School of Business, as well as 19 graduate programs in the arts and sciences...

 in New Hampshire
New Hampshire
New Hampshire is a state in the New England region of the northeastern United States of America. The state was named after the southern English county of Hampshire. It is bordered by Massachusetts to the south, Vermont to the west, Maine and the Atlantic Ocean to the east, and the Canadian...

, USA
United States
The United States of America is a federal constitutional republic comprising fifty states and a federal district...

 to provide computer access to non-science students. At the time, nearly all use of computers required writing custom software, which was something only scientist
Scientist
A scientist in a broad sense is one engaging in a systematic activity to acquire knowledge. In a more restricted sense, a scientist is an individual who uses the scientific method. The person may be an expert in one or more areas of science. This article focuses on the more restricted use of the word...

s and mathematician
Mathematician
A mathematician is a person whose primary area of study is the field of mathematics. Mathematicians are concerned with quantity, structure, space, and change....

s tended to do. The language and its variants became widespread on microcomputer
Microcomputer
A microcomputer is a computer with a microprocessor as its central processing unit. They are physically small compared to mainframe and minicomputers...

s in the late 1970s and 1980s, when it was typically a standard feature, and often actually built into the firmware of the machine.

BASIC remains popular to this day in a handful of highly modified dialect
Programming language dialect
A dialect of a programming language is a variation or extension of the language that does not change its intrinsic nature. With languages such as Scheme and Forth, standards may be considered insufficient, inadequate or even illegitimate by implementors, so often they will deviate from the...

s and new languages influenced by BASIC such as Microsoft Visual Basic
Visual Basic
Visual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model...

. In 2006, 59% of developers for the .NET Framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

 used Visual Basic .NET
Visual Basic .NET
Visual Basic .NET , is an object-oriented computer programming language that can be viewed as an evolution of the classic Visual Basic , which is implemented on the .NET Framework...

 as their only programming language.

History

Before the mid-1960s, computer
Computer
A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem...

s were extremely expensive and used only for special-purpose tasks. A simple batch processing
Batch processing
Batch processing is execution of a series of programs on a computer without manual intervention.Batch jobs are set up so they can be run to completion without manual intervention, so all input data is preselected through scripts or command-line parameters...

 arrangement ran only a single "job" at a time, one after another. But during the 1960s faster and more affordable computers became available. and as prices decreased newer computer systems supported time-sharing
Time-sharing
Time-sharing is the sharing of a computing resource among many users by means of multiprogramming and multi-tasking. Its introduction in the 1960s, and emergence as the prominent model of computing in the 1970s, represents a major technological shift in the history of computing.By allowing a large...

, a system which allows multiple users or processes to use the CPU and memory. In such a system the operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 alternates between running processes, giving each one running time on the CPU before switching to another. The machines had become fast enough that most users could feel they had the machine all to themselves.

Origin

The original BASIC language was designed in 1964 by John Kemeny
John George Kemeny
John George Kemeny was a Hungarian American mathematician, computer scientist, and educator best known for co-developing the BASIC programming language in 1964 with Thomas E. Kurtz. Kemeny served as the 13th President of Dartmouth College from 1970 to 1981 and pioneered the use of computers in...

 and Thomas Kurtz
Thomas Eugene Kurtz
Thomas Eugene Kurtz is an American computer scientist who co-developed the BASIC programming language during 1963 to 1964, together with John G. Kemeny....

 and implemented by a team of Dartmouth students under their direction. The acronym is tied to the name of an unpublished paper by Thomas Kurtz and is not a backronym
Backronym
A backronym or bacronym is a phrase constructed purposely, such that an acronym can be formed to a specific desired word. Backronyms may be invented with serious or humorous intent, or may be a type of false or folk etymology....

. BASIC was designed to allow students to write programs for the Dartmouth Time-Sharing System. It was intended specifically for the new class of users that time-sharing systems allowed—that is, a less technical user who did not have the mathematical background of the more traditional users and was not interested in acquiring it. Being able to use a computer to support teaching and research was quite novel at the time.

The language was based on FORTRAN II
Fortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...

, with some influences from ALGOL 60
ALGOL 60
ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...

 and with additions to make it suitable for timesharing. Initially, BASIC concentrated on supporting straightforward mathematical work, with matrix arithmetic support from its initial implementation as a batch language and full string functionality being added by 1965.

The designers of the language decided to make the compiler available free of charge so that the language would become widespread. They also made it available to high schools in the Hanover
Hanover, New Hampshire
Hanover is a town along the Connecticut River in Grafton County, New Hampshire, United States. The population was 11,260 at the 2010 census. CNN and Money magazine rated Hanover the sixth best place to live in America in 2011, and the second best in 2007....

 area and put a considerable amount of effort into promoting the language. In the following years, as other dialects of BASIC appeared, Kemeny and Kurtz's original BASIC dialect became known as Dartmouth BASIC
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It is so named because it was designed and implemented at Dartmouth College...

.

Spread on minicomputers

As a result of its free availability, knowledge of BASIC became relatively widespread (for a computer language) and BASIC was implemented by a number of manufacturers, becoming fairly popular on newer minicomputer
Minicomputer
A minicomputer is a class of multi-user computers that lies in the middle range of the computing spectrum, in between the largest multi-user systems and the smallest single-user systems...

s like the DEC
Digital Equipment Corporation
Digital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...

 PDP
Programmed Data Processor
Programmed Data Processor was the name of a series of minicomputers made by Digital Equipment Corporation. The name 'PDP' intentionally avoided the use of the term 'computer' because, at the time of the first PDPs, computers had a reputation of being large, complicated, and expensive machines, and...

 series and the Data General Nova
Data General Nova
The Data General Nova was a popular 16-bit minicomputer built by the American company Data General starting in 1969. The Nova was packaged into a single rack mount case and had enough power to do most simple computing tasks. The Nova became popular in science laboratories around the world, and...

. The BASIC language was also central to the HP Time-Shared BASIC system in the late 1960s and early 1970s, and the Pick operating system
Pick operating system
The Pick operating system is a demand-paged, multiuser, virtual memory, time-sharing operating system based around a unique "multivalued" database. Pick is used primarily for business data processing...

. In these instances the language tended to be implemented as an interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...

, instead of, or in addition to, a compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

.

Explosive growth: the home computer era

The introduction of the first microcomputer
Microcomputer
A microcomputer is a computer with a microprocessor as its central processing unit. They are physically small compared to mainframe and minicomputers...

s in the mid-1970s was the start of explosive growth for BASIC. It had the advantage that it was fairly well known to the young designers and computer hobbyists who took an interest in microcomputers.

One of the first to appear was Tiny BASIC
Tiny BASIC
Tiny BASIC is a dialect of the BASIC programming language that can fit into as little as 2 or 3 KB of memory. This small size made it invaluable in the early days of microcomputers , when typical memory size was only 4–8 KB.- History :...

, a simple BASIC variant designed by Dennis Allison at the urging of Bob Albrecht of the Homebrew Computer Club
Homebrew Computer Club
The Homebrew Computer Club was an early computer hobbyist users' group in Silicon Valley, which met from March 5, 1975 to December 1986...

. He had seen BASIC on minicomputer
Minicomputer
A minicomputer is a class of multi-user computers that lies in the middle range of the computing spectrum, in between the largest multi-user systems and the smallest single-user systems...

s and felt it would be the perfect match for new machines like the MITS Altair 8800
Altair 8800
The MITS Altair 8800 was a microcomputer design from 1975 based on the Intel 8080 CPU and sold by mail order through advertisements in Popular Electronics, Radio-Electronics and other hobbyist magazines. The designers hoped to sell only a few hundred build-it-yourself kits to hobbyists, and were...

. How to design and implement a stripped-down version of an interpreter for the BASIC language was covered in articles by Allison in the first three quarterly issues of the People's Computer Company
People's Computer Company
People's Computer Company was an organization, a newsletter and, later, a quasiperiodical called the "dragonsmoke." PCC was founded and produced by Bob Albrecht & George Firedrake in Menlo Park, California in the early 1970s.The first newsletter announced itself with the following...

 newsletter published in 1975 and implementations with source code published in Dr. Dobb's Journal of Tiny BASIC Calisthenics & Orthodontia: Running Light without Overbyte. Version were written by Dr. Li-Chen Wang
Li-Chen Wang
Dr. Li-Chen Wang is an American computer engineer, best known for his Palo Alto Tiny BASIC for Intel 8080-based microcomputers.This was the fourth version of Tiny BASIC that appeared in Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, but probably the most influential. It appeared in the...

, and Tom Pittman.

In 1975, MITS released Altair BASIC
Altair BASIC
Altair BASIC was an interpreter for the BASIC programming language that ran on the MITS Altair 8800 and subsequent S-100 bus computers. It was Microsoft's first product , distributed by MITS under a contract...

, developed by Bill Gates
Bill Gates
William Henry "Bill" Gates III is an American business magnate, investor, philanthropist, and author. Gates is the former CEO and current chairman of Microsoft, the software company he founded with Paul Allen...

 and Paul Allen
Paul Allen
Paul Gardner Allen is an American business magnate, investor, and philanthropist. Allen co-founded Microsoft with Bill Gates...

 as the company Micro-Soft, which grew into today's corporate giant, Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

. The first Altair version was co-written by Gates, Allen, and Monte Davidoff
Monte Davidoff
Monte Davidoff is an American computer programmer. He graduated from Nicolet High School in Glendale, Wisconsin in 1974. He went on to Harvard University, where he majored in applied mathematics, the department at Harvard that, at the time, included computer science. He also worked at WHRB, the...

.

When the Apple II, PET 2001 and TRS-80
TRS-80
TRS-80 was Tandy Corporation's desktop microcomputer model line, sold through Tandy's Radio Shack stores in the late 1970s and early 1980s. The first units, ordered unseen, were delivered in November 1977, and rolled out to the stores the third week of December. The line won popularity with...

 were all released in 1977, all three had BASIC as their primary programming language and operating environment. Commodore Business Machines a version of Micro-Soft BASIC while Apple II and TRS-80
TRS-80
TRS-80 was Tandy Corporation's desktop microcomputer model line, sold through Tandy's Radio Shack stores in the late 1970s and early 1980s. The first units, ordered unseen, were delivered in November 1977, and rolled out to the stores the third week of December. The line won popularity with...

 both introduced new, largely similar versions of the language. As new companies entered the field, additional versions were added that subtly changed the BASIC family. The Atari 8-bit family
Atari 8-bit family
The Atari 8-bit family is a series of 8-bit home computers manufactured from 1979 to 1992. All are based on the MOS Technology 6502 CPU and were the first home computers designed with custom coprocessor chips...

 had their own Atari BASIC
Atari BASIC
Atari BASIC is a BASIC interpreter for the Atari 8-bit family of 6502-based home computers. The interpreter originally shipped on an 8 KB cartridge; on later XL/XE model computers it was built in, with an option to disable it, and started when the machines were booted with no other cartridges...

 that was modified in order to fit on an 8 kB ROM cartridge. The BBC
BBC
The British Broadcasting Corporation is a British public service broadcaster. Its headquarters is at Broadcasting House in the City of Westminster, London. It is the largest broadcaster in the world, with about 23,000 staff...

 published BBC BASIC
BBC BASIC
BBC BASIC is a programming language, developed in 1981 as a native programming language for the MOS Technology 6502 based Acorn BBC Micro home/personal computer, mainly by Sophie Wilson. It is a version of the BASIC programming language adapted for a U.K...

, developed for them by Acorn Computers Ltd, incorporating many extra structuring keywords. Almost universally, home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a single nontechnical user...

s of the 1980s had a ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...

-resident BASIC interpreter, allowing the machines to boot directly into BASIC which therefore constituted a significant and visible part of the user interface
User interface
The user interface, in the industrial design field of human–machine interaction, is the space where interaction between humans and machines occurs. The goal of interaction between a human and a machine at the user interface is effective operation and control of the machine, and feedback from the...

 of many home computers' rudimentary operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s.

As the popularity of BASIC grew in this period, magazines (such as Creative Computing Magazine
Creative Computing
Creative Computing was one of the earliest magazines covering the microcomputer revolution. Published from 1974 until December 1985, Creative Computing covered the whole spectrum of hobbyist/home/personal computing in a more accessible format than the rather technically-oriented BYTE. The magazine...

in the US) published complete source code in BASIC for games, utilities, and other programs. Given BASIC's straightforward nature, it was a simple matter to type in the code
Type-in program
A type-in program, or just type-in, is a computer program listing printed in a computer magazine or book, meant to be typed in by the reader in order to run the program on a computer....

 from the magazine and execute the program. Different magazines were published featuring programs for specific computers, though some BASIC programs were considered universal and could be used in machines running any variant of BASIC (sometimes with minor adaptations). BASIC source code was also published in fully-fledged books: the seminal examples being David Ahl
David H. Ahl
David H. Ahl is the founder of Creative Computing magazine. He is also the author of many how-to books, including BASIC Computer Games, the first million-selling computer book....

's BASIC Computer Games
BASIC Computer Games
BASIC Computer Games is a compilation of type-in computer games in the BASIC programming language collected by David H. Ahl. Some of the games were written or modified by Ahl as well...

 series. Later packages, such as Learn to Program BASIC would also have gaming as an introductory focus.

On the business-focused CP/M
CP/M
CP/M was a mass-market operating system created for Intel 8080/85 based microcomputers by Gary Kildall of Digital Research, Inc...

 computers which soon became widespread in small business environments, Microsoft BASIC
Microsoft BASIC
Microsoft BASIC was the foundation product of the Microsoft company. It first appeared in 1975 as Altair BASIC, which was the first BASIC, and the first high level programming language available for the MITS Altair 8800 hobbyist microcomputer....

 (MBASIC
MBASIC
MBASIC is the Microsoft BASIC implementation of BASIC for the CP/M operating system. MBASIC is a descendant of the original Altair BASIC interpreters that were among Microsoft's first products. MBASIC was one of the two versions of BASIC bundled with the Osborne 1 computer...

) was one of the leading applications.

The IBM PC, and compatibles

When IBM were designing the IBM PC
IBM PC
The IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...

 they followed the paradigm of existing home computers in wanting to have a built-in BASIC. They sourced this from Microsoft - IBM Cassette BASIC
IBM Cassette BASIC
IBM Cassette BASIC was a version of the Microsoft BASIC programming language licensed by IBM for the IBM PC. It was included in the BIOS ROM of the original IBM PC. Cassette BASIC provided the default user interface if there was no floppy disk drive installed, or if the boot code did not find a...

 - but Microsoft also produced several other later versions of BASIC for MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

/PC-DOS
PC-DOS
IBM PC DOS is a DOS system for the IBM Personal Computer and compatibles, manufactured and sold by IBM from the 1980s to the 2000s....

 including IBM Disk BASIC
IBM Disk BASIC
IBM Disk BASIC was a version of the Microsoft BASIC programming language licensed by IBM for the IBM PC DOS. It was included in the original IBM PC DOS and required the original IBM PC BIOS to run. The name Disk BASIC came from its use of floppy disks rather than cassette tapes to store programs...

 (BASIC D), IBM BASICA (BASIC A), GW-BASIC (a BASICA-compatible version that did not need IBM's ROM) and QuickBASIC
QuickBASIC
Microsoft QuickBASIC is an Integrated Development Environment and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was a short-lived version for Mac OS...

, all typically bundled with the machine. In addition they produced the Microsoft BASIC Compiler aimed at professional programmers.

Turbo Pascal
Pascal (programming language)
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal...

-publisher Borland
Borland
Borland Software Corporation is a software company first headquartered in Scotts Valley, California, Cupertino, California and finally Austin, Texas. It is now a Micro Focus subsidiary. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn.-The 1980s:...

 published Turbo Basic
Turbo BASIC
Turbo Basic is a BASIC compiler and dialect originally created by Robert "Bob" Zale and bought from him by Borland. When Borland decided to stop publishing it, Zale bought it back from them, renamed it to PowerBASIC and set up PowerBASIC Inc...

 1.0 in 1985 (successor versions are still being marketed by the original author under the name PowerBASIC
PowerBASIC
PowerBASIC is the brand of several commercial compilers by Venice, Florida-based PowerBASIC Inc. that compile a dialect of the BASIC programming language. The DOS versions have a syntax similar to that of QBasic and QuickBASIC, while the Windows versions utilize a standard BASIC syntax that can be...

). Microsoft wrote the windowing based AmigaBASIC
AmigaBASIC
AmigaBASIC was an interpreted BASIC programming language implementation for the Amiga, designed and written by Microsoft. AmigaBASIC shipped with AmigaOS versions 1.1 to 1.3...

 that was supplied with version 1.1 of the pre-emptive multitasking GUI Amiga computers (late 1985/ early 1986), although the product unusually did not bear any Microsoft marks.

These languages introduced many extensions to the original home computer BASIC, such as improved string manipulation and graphics support, access to the file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

 and additional data type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

s. More important were the facilities for structured programming
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...

, including additional control structures and proper subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s supporting local variable
Local variable
In computer science, a local variable is a variable that is given local scope. Such a variable is accessible only from the function or block in which it is declared. In programming languages with only two levels of visibility, local variables are contrasted with global variables...

s.

However, by the latter half of the 1980s users were increasingly using applications written by others, rather than learning programming themselves, while professional programmers now had a wide range of more advanced languages available and BASIC tended to become the butt of derogatory comments such as Dijkstra's famous "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration".

Visual Basic

BASIC's fortunes reversed once again with the introduction in 1991 of Visual Basic
Visual Basic
Visual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model...

 ("VB"), by Microsoft. The only significant similarity to older BASIC dialects was familiar syntax. Syntax itself no longer "fully defined" the language, since much development was done using "drag and drop" methods without exposing all code for commonly used objects such as buttons and scrollbars to the developer. While this could be considered an evolution of the language, few of the distinctive features of early Dartmouth BASIC
Dartmouth BASIC
Dartmouth BASIC is the original version of the BASIC programming language. It is so named because it was designed and implemented at Dartmouth College...

, such as line number
Line number
In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line.In the C...

s and the INPUT keyword, remain (although Visual Basic still uses INPUT to read data from files, and INPUTBOX is available for direct user input; line numbers can also optionally be used in all VB versions, even VB.NET, albeit they cannot be used in certain places, for instance before SUB).

Ironically given the origin of BASIC as a "beginner's" language, and apparently even to the surprise of many at Microsoft who still initially marketed it as a language for hobbyists, the language had come into widespread use for small custom business applications shortly after the release of VB version 3.0, which is widely considered the first relatively stable version. While many advanced programmers still scoffed at its use, VB met the needs of small businesses efficiently wherever processing speed was less of a concern than easy development. By that time, computers running Windows 3.1 had become fast enough that many business-related processes could be completed "in the blink of an eye" even using a "slow" language, as long as massive amounts of data were not involved. Many small business owners found they could create their own small yet useful applications in a few evenings to meet their own specialized needs. Eventually, during the lengthy lifetime of VB3, knowledge of Visual Basic had become a marketable job skill.

Microsoft also produced VBScript
VBScript
VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...

 in 1996 and Visual Basic .NET
Visual Basic .NET
Visual Basic .NET , is an object-oriented computer programming language that can be viewed as an evolution of the classic Visual Basic , which is implemented on the .NET Framework...

 in 2001.

Recent versions

Many BASIC dialects have also sprung up in the last few years, including Bywater BASIC and True BASIC
True BASIC
True BASIC is a variant of the BASIC programming language descended from Dartmouth BASIC — the original BASIC — invented by college professors John G. Kemeny and Thomas E...

 (the direct successor to Dartmouth BASIC from a company controlled by Kurtz). One notable variant is RealBasic
REALbasic
Realbasic is the object-oriented dialect of the BASIC programming language used in Real Studio, a programming environment, developed and commercially marketed by Real Software, Inc of Austin, Texas for Mac OS X, Microsoft Windows, 32-bit x86 Linux and the web.- Language features :RB is a strongly...

 which although first released in 1998 for Macintosh computers, has since 2005 fully compiled programs for Microsoft Windows, Mac OS X and 32-bit x86 Linux, from the same object-oriented source code. RealBasic compiled programs may execute natively on these platforms as services, consoles or windowed applications. However in keeping with BASIC tradition, one-platform hobbyist versions are also still maintained. Many other BASIC variants and adaptations have been written by hobbyists, equipment developers, and others, as it is a relatively simple language to develop translators for. More complex examples of free software BASIC implementations (development tools and compilers) include Gambas
Gambas
Gambas is the name of an object-oriented dialect of the BASIC programming language as well as the integrated development environment that accompanies it. Designed to run on Linux and other Unix-like computer operating systems, its name is a recursive acronym for Gambas Almost Means Basic...

 and FreeBASIC
FreeBASIC
FreeBASIC is a free/open source , 32-bit BASIC compiler for Microsoft Windows, protected-mode DOS , Linux, FreeBSD and Xbox....

.

Nostalgia

The ubiquity of BASIC interpreters on personal computers was such that textbooks once included simple "Try It In BASIC" exercises that encouraged students to experiment with mathematical and computational concepts on classroom or home computers and computer magazines typically included type-in program
Type-in program
A type-in program, or just type-in, is a computer program listing printed in a computer magazine or book, meant to be typed in by the reader in order to run the program on a computer....

s. Futurist and sci-fi writer David Brin
David Brin
Glen David Brin, Ph.D. is an American scientist and award-winning author of science fiction. He has received the Hugo, Locus, Campbell and Nebula Awards.-Biography:...

 mourned the loss of ubiquitous BASIC in a 2006 Salon article as have others who first used computers during this era.

Typical BASIC keywords

Data manipulation:
  • LET: assigns a value (which may be the result of an expression
    Expression (programming)
    An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces another value...

    ) to a variable.
  • DATA: holds a list of values which are assigned sequentially using the READ command.


Program flow control:
  • IF ... THEN ... ELSE: used to perform comparisons or make decisions.
  • FOR ... TO ... {STEP} ... NEXT: repeat a section of code a given number of times. A variable that acts as a counter is available within the loop.
  • WHILE ... WEND and REPEAT ... UNTIL: repeat a section of code while the specified condition is true. The condition may be evaluated before each iteration of the loop, or after.
  • DO ... LOOP {WHILE} or {UNTIL}: repeat a section of code Forever or While/Until the specified condition is true . The condition may be evaluated before each iteration of the loop, or after.
  • GOTO: jumps to a numbered or labelled line in the program.
  • GOSUB: temporarily jumps to a numbered or labelled line, returning to the following line after encountering the RETURN Command. This is used to implement subroutine
    Subroutine
    In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

    s.
  • ON ... GOTO/GOSUB: chooses where to jump based on the specified conditions. See Switch statement
    Switch statement
    In computer programming, a switch, case, select or inspect statement is a type of selection control mechanism that exists in most imperative programming languages such as Pascal, Ada, C/C++, C#, Java, and so on. It is also included in several other types of languages...

     for other forms.


Input and output:
  • PRINT: displays a message on the screen or other output device.
  • INPUT: asks the user to enter the value of a variable. The statement may include a prompt message.
  • TAB or AT: sets the position where the next character will be shown on the screen or printed on paper.


Miscellaneous:
  • REM: holds a programmer's comment; often used to give a title to the program and to help identify the purpose of a given section of code.

Data types and variables

Minimal versions of BASIC had only integer variables and one-letter variable names. More powerful versions had floating-point arithmetic, and variables could be labelled with names six or more characters long.

String
String (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....

 variables are usually distinguished in many microcomputer dialects by having $ suffixed to their name, and string values are typically enclosed in quotation marks.

Arrays in BASIC could contain integers, floating point or string variables.

Some dialects of BASIC supported matrices and matrix operations
Matrix (mathematics)
In mathematics, a matrix is a rectangular array of numbers, symbols, or expressions. The individual items in a matrix are called its elements or entries. An example of a matrix with six elements isMatrices of the same size can be added or subtracted element by element...

, useful for the solution of sets of simultaneous linear algebraic equations. These dialects would support matrix operations such as assignment, addition, multiplication (of compatible matrix types), and evaluation of a determinant. Microcomputer dialects often lacked this data type and required a programmer to provide subroutines to carry out equvalent operations.

Examples

The original Dartmouth Basic was unusual in having a matrix keyword, MAT. Although dropped by most later microprocessor derivatives it is used in this example from the 1968 manual which averages the numbers that are input:


5 LET S = 0
10 MAT INPUT V
20 LET N = NUM
30 IF N = 0 THEN 99
40 FOR I = 1 TO N
45 LET S = S + V(I)
50 NEXT I
60 PRINT S/N
70 GO TO 5
99 END


New BASIC programmers on a home computer might start with a simple program similar to the Hello world program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

 made famous by Kernighan and Ritchie. This generally involves simple use of the language's PRINT statement to display the message (such as the programmer's name) to the screen. Often an infinite loop
Infinite loop
An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over...

 was used to fill the display with the message. Most first generation BASIC languages such as MSX BASIC
MSX BASIC
MSX BASIC is a dialect of the BASIC programming language. It is an extended version of Microsoft Standard BASIC Version 4.5, and includes support for graphic, music, and various peripherals attached to MSX Personal Computers. Generally, MSX-BASIC is designed to follow GW-BASIC, which is one of the...

 and GW-BASIC
GW-BASIC
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...

 supported simple data types, loop cycles and arrays. The following example is written for GW-BASIC, but will work in most versions of BASIC with minimal changes:


10 INPUT "What is your name: ", U$
20 PRINT "Hello "; U$
30 INPUT "How many stars do you want: ", N
40 S$ = ""
50 FOR I = 1 TO N
60 S$ = S$ + "*"
70 NEXT I
80 PRINT S$
90 INPUT "Do you want more stars? ", A$
100 IF LEN(A$) = 0 THEN GOTO 90
110 A$ = LEFT$(A$, 1)
120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
130 PRINT "Goodbye "; U$
140 END

The resulting dialog might resemble:

What is your name: Mike
Hello Mike
How many stars do you want: 7
*******
Do you want more stars? yes
How many stars do you want: 3
***
Do you want more stars? no
Goodbye Mike

Second generation BASICs (for example QuickBASIC
QuickBASIC
Microsoft QuickBASIC is an Integrated Development Environment and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was a short-lived version for Mac OS...

 and PowerBASIC
PowerBASIC
PowerBASIC is the brand of several commercial compilers by Venice, Florida-based PowerBASIC Inc. that compile a dialect of the BASIC programming language. The DOS versions have a syntax similar to that of QBasic and QuickBASIC, while the Windows versions utilize a standard BASIC syntax that can be...

) introduced a number of features into the language, primarily related to structured and procedure-oriented programming. Usually, line number
Line number
In computing, a line number is a method used to specify a particular sequence of characters in a text file. The most common method of assigning numbers to lines is to assign every line a unique number, starting at 1 for the first line, and incrementing by 1 for each successive line.In the C...

ing is omitted from the language and replaced with labels (for GOTO
Goto
goto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control...

) and procedure
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s to encourage easier and more flexible design.


INPUT "What is your name: ", UserName$
PRINT "Hello "; UserName$
DO
INPUT "How many stars do you want: ", NumStars
Stars$ = STRING$(NumStars, "*")
PRINT Stars$
DO
INPUT "Do you want more stars? ", Answer$
LOOP UNTIL Answer$ <> ""
Answer$ = LEFT$(Answer$, 1)
LOOP WHILE UCASE$(Answer$) = "Y"
PRINT "Goodbye "; UserName$


Third generation BASIC dialects such as Visual Basic
Visual Basic
Visual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model...

, REALbasic
REALbasic
Realbasic is the object-oriented dialect of the BASIC programming language used in Real Studio, a programming environment, developed and commercially marketed by Real Software, Inc of Austin, Texas for Mac OS X, Microsoft Windows, 32-bit x86 Linux and the web.- Language features :RB is a strongly...

, StarOffice Basic
StarOffice Basic
StarOffice Basic is a dialect of BASIC that is included with the OpenOffice.org and StarOffice office suites.-Example:...

 and BlitzMax introduced features to support object-oriented and event-driven programming paradigm. Most built-in procedures and functions now represented as methods of standard objects rather than operators.

The following example is in Visual Basic .NET
Visual Basic .NET
Visual Basic .NET , is an object-oriented computer programming language that can be viewed as an evolution of the classic Visual Basic , which is implemented on the .NET Framework...

:

Public Class StarsProgram
Public Shared Sub Main
Dim UserName, Answer, stars As String, NumStars As Integer
Console.Write("What is your name: ")
UserName = Console.ReadLine
Console.WriteLine("Hello {0}", UserName)
Do
Console.Write("How many stars do you want: ")
NumStars = CInt(Console.ReadLine)
stars = New String("*", NumStars)
Console.WriteLine(stars)
Do
Console.Write("Do you want more stars? ")
Answer = Console.ReadLine
Loop Until Answer <> ""
Answer = Answer.Substring(0, 1)
Loop While Answer.ToUpper = "Y"
Console.WriteLine("Goodbye {0}", UserName)
End Sub
End Class

Standards

  • ANSI/ISO/IEC Standard for Minimal BASIC:
    • ANSI X3.60-1978 "For minimal BASIC"
    • ISO/IEC 6373:1984 "Data Processing — Programming Languages — Minimal BASIC"
  • ANSI/ISO/IEC Standard for Full BASIC:
  • ANSI/ISO/IEC Addendum Defining Modules:
    • ANSI X3.113 Interpretations-1992 "BASIC Technical Information Bulletin # 1 Interpretations of ANSI 03.113-1987"
    • ISO/IEC 10279:1991/ Amd 1:1994 "Modules and Single Character Input Enhancement"
  • ECMA
    ECMA
    Ecma or ECMA may refer to:* Ecma International, an international standards organization for Information Communication Technology and Consumer Electronics* Engineering College Magazines Associated, a group of student-run engineering-based publications...

    -116 BASIC (withdrawn, similar to ANSI X3.113-1987)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK