QBasic

The opening screen of QBasic 1.1
Enlarge
The opening screen of QBasic 1.1

QBasic (an acronym for Quick Beginner's All-purpose Symbolic Instruction Code) is a variant of the BASIC programming language. It is not capable of compiling standalone executables. The source code is compiled to an intermediate form within the integrated development environment (IDE), and this intermediate form is immediately interpreted on demand within the IDE. It was intended as a replacement for GWBASIC, and was shipped together with MS-DOS 5.0 and higher, including Windows 95. QBasic was based on the earlier QuickBASIC 4.5 compiler but without QuickBASIC's compiler and linker elements.

Microsoft stopped shipping QBasic with later versions of Windows. Windows 98 users, however, will find it in the \TOOLS\OLDMSDOS directory of the CD-ROM; on the Windows 95 CD-ROM, it is in the \OTHER\OLDMSDOS directory. It is now only available from Microsoft's website for licensed users of MS-DOS. QBasic provided a state-of-the-art IDE (for its time), including a debugger with features such as on-the-fly expression evaluation and code modification that were still relatively unusual in 2003, more than ten years later.

QBasic was also the subject of several programming books for beginners.

Using the free DOSBox emulator it today runs on almost all platforms such as Windows NT, Linux, FreeBSD, etc.

QBasic came complete with a couple of pre-written example games. These were Nibbles (a variant of the Snake game) and Gorillas, an explosive-banana throwing game.

Contents

Syntax

Like QuickBASIC, but unlike earlier versions of Microsoft BASIC, QBasic was a structured programming language, supporting constructs such as named subroutines and while loops. Line numbers, a concept often associated with BASIC, were supported for compatibility, but were not necessary and not considered good form, having been replaced by descriptive line labels. QBasic has limited support for user-defined data types (structures), and several primitive types used to contain strings of text or numeric data.

Code Example

The following code displays "Hello, World" and makes weird sounds:

PRINT "Hello, World"
FOR Note = 450 TO 750 STEP 20
    SOUND Note, 1
    SOUND 800 - Note, 1
NEXT Note
FOR Note = 750 TO 450 STEP -20
    SOUND Note, 1
    SOUND 750 + Note, 1
NEXT Note
FOR Note = 100 TO 1000 STEP 20
    SOUND Note, 1
    SOUND 750 + Note, 1
NEXT Note
END

Special Keys

Press Ctrl+Break to break a running program.
Press F5 to continue a program whose execution was broken.
Press Shift+F5 to restart a program back from the beginning.
Press F4 while program execution is broken to view the run-time screen, then press F4 again to switch back to the code screen.
Press F1 for help.

External links

es:QBASIC fr:QBasic nl:Programmeertaal QBasic pl:QBasic ru:QBASIC sv:QBasic tr:QBASIC zh:QBASIC

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools