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 >> Tutorial >> Overview

QBasic Information Center Tutorials - Overview
These tutorials were written to help you get a quick, but thorough, understanding of QBasic - the scope of the language as well as it's specific capabilities.

QBasic Overview
QBasic has features common to many other languages. It does use the common BASIC syntax (vs C-style used by several other popular languages), but otherwise uses standard operators, has typed variables, comes with a wide variety of built-in functions, supports subroutines/functions, provides flow control, handles files, and can call on system resources. All of these are covered in this tutorial.

Creating & Executing Programs
QBasic programs consist of text statements which are stored in text files that can be edited by any text editor, such as the free Windows NotePad. There are literally hundreds of programmer's editors (text editors with special features to improve a programmer's productivity) which can be used to edit QBasic code. However the QBasic built-in text editor is usually adequate for most QBasic programmer needs.

QBasic is an interpreted language, meaning that the source code is read and executed line by line. No executable (EXE) file is created by QBasic (see below for a work-around).

Applications
Interpreted programs generally run slower than the corresponding compiled programs, so QBasic programs are often used where speed is not an issue. Programmers often create "throw-away" QBasic programs - those which are used just once to perform a specific task, where getting the job done is more important than how long it takes.

Another major use of QBasic was to create games - lots of games. Despite its very minimal graphics capabilities, the fact that it was free and readily available as part of the MS-DOS 5/6 distributions gave it wide acceptance by programmers, especially young programmers whose primary interest was games. These, and later, programmers pushed

Compilation, Anyways!
A major problem with QBasic interpreted programs is users had to have QBasic on their PC and needed to be at least somewhat familiar with its use. This made distribution of executables far more preferable than then distribution of interpreted versions.

The good news is that the QuickBasic compiler (BASCOM) can be used to compile QBasic programs. QuickBasic, the Microsoft commercial product from which QBasic was derived, is no longer sold but continues to be available for download on the web. Microsoft appears to allow its distribution "unofficially" but still owns the copyright to the product.

Program Flow
Execution of a QBasic program begins with the first line of source code and ends with the last line of code, although an "End" command can be used to stop the program at any time.

Limitations
Simply put, QBasic is too limited to be a professional programmer's language of choice. Still, there are thousands of programmers who continue to use QBasic, as can you if the following limitations are acceptable.

  • No Compiler
    Not having an EXE to distribute means users must have QBasic on their PCs (unless you have access to BASCOM).

  • Limited IDE
    The editor that comes with QBasic is very primitive. Modern IDEs greatly enhance the productivity of a programmer.

  • Cannot Create Windows GUI Programs
    Today's users are very demanding and expect the standard features of Windows programs. QBasic primarily produces a text-based output and cannot provide a standard windows program.

    The lack of graphics support is the nail in the coffin for most programmers and users.

  • Minimal File handling
    While QBasic has some file/folder handling capabilities, it takes a lot of effort on the part of a programmer to work with files. A serious problem for today's programmers is that QBasic does not support long file names - it only supports the 8.3 filename spec of the MS-DOS era. Other programming languages provide far more features which make the programmer's job considerably easier.

  • No API/DLL Support
    A lot of features provided by modern applications requires access to the Windows API, which QBasic does not support.

If you have any suggestions or questions, please let me know.