Getting Started
Introduction
Sample Programs
QBasic IDEs
History
Advice
Tools
Mini-Tutorial
Tutorial
Code Snippets

Resources
Web Sites
More Tutorials
Vendors
Books
Magazines
NewsLetters
NewsGroups
Forums
User Groups
Talk Shows
Blogs

GBIC >> QBasic >> Introduction

Introduction to QBasic
QBasic is a free programming language known primarily for having been distributed freely with MS-DOS and Windows. Though very simple by today's standards, QBasic can still be used to perform a variety of useful tasks. It is also an excellent educational tool for learning to program.

Here are a few fundamental details about QBasic that you need to understand. If you're already a programmer these may seem pretty basic but for first time programmers these points seldom get mentioned.

  • Free
    QBasic is free and can be downloaded from here. It's also easy to find a download on many other web sites. Version 1.1 is the last version released by Microsoft.

  • QBasic Installation
    Simply unzip the file contents (2 files) into a folder of your choice and run the qbasic.exe file from there.

  • No Compiler
    QBasic is an interpreted language. It does not come with a compiler which converts the code to an EXE file.

    However, code written

  • IDE (Integrated Development Environment)?
    QBasic comes with a very simple text editor but it's a stretch to call it and IDE. The built-in editor is generally adequate for simple programs, but any text editor can be used to edit QBasic programs.

    See my discussion on QBasic IDEs for more information.

  • QBasic Scripts
    A QBasic program is simply a text file in which you place commands that the QBasic interpreter executes at run time.

    The code for QBasic is a full fledged computer program, but some programmers call the programs a "script" to reflect the fact that QBasic programs are interpreted at run time rather than executed from a compiled version.

    The file name can be anything you want. No specific extension is required, although ".bas" is the standard suffix and is assumed if no suffix is provided.

  • Run a Program - qbasic.exe
    The QBasic interpreter (the program that executes the QBasic script) is "qbasic.exe". Programs can be typed directly into the editor or loaded from a file. QBasic supports only the 8.3 file naming convention. It does not recognize the long file names of the modern Windows OS.

    To load a QBasic program file into the QBasic editor, simply type in:

        qbasic filename    
        
    If no filename suffix is provided, ".bas" is assumed.

    To run the loaded program, press F5 from within the QBasic editor.

    Note that when a program runs, the QBasic editor temporarily disappears and the output of the program is placed in an MSDOS window, with the message "Press any key to continue" displayed at the bottom of the screen. Once a key is pressed the QBasic editor appears.

Alternate Suggestion #1 - GW-Basic
As noted, QBasic provides an excellent, easy to understand introduction to programming. It provides both educational and utility value. However, beginning programmers might want to consider starting out with GW-BASIC, which is similar to, but simpler than, QBasic.

I've documented the differences between QBasic and GW-BASIC here.

One strategy is to start with GW-BASIC and then switch to QBasic later as your understanding of and need for programming language features increase. The transition is relatively easy.

Note that I recommend starting with QBasic. The comments on GW-BASIC are simply to inform my readers of available options.

Alternate Suggestion #2 - Other BASIC Dialects
Since QBasic was released in 1992, many new BASIC dialects have been released, particularly those which can be used to create true Windows programs with modern graphical capabilities.

I've compiled a summary of available dialects, both free and commercial. While QBasic is still very popular, most programmers have moved to one of these newer releases in order to take advantage of the graphical features of Windows. My summary categorizes the dialects and provides guidance on which are most popular with programmers.

Both freeware and commercial dialects are available. Generally, the commercial dialects provide the most capability, but the top freeware versions are extremely popular as well.