Introduction To QBASIC - Online Article

BASIC stands for Beginners of All purpose Symbolic Instruction Code.

BASIC was developed at Dartmouth College by John Kemeny and Thomas Kurtz in the mid 1960s. BASIC is the best way to start or learn programming. Its user friendly, fun and very easy to learn! Even Bill Gates concurs with that statement!

To be frank you cannot be categorized as a 'developer' if you start coding in basic, but it's your first step to. Yet never underestimate BASIC. It's very powerful and lot can be done with it. All it needs is a creative mind and some programming skills that you will eventually learn in this tutorial. It will help you to know and understand the logic of programming and design of algorithms.

There are many versions of basic available starting from BASICA, GWBASIC to a more advanced QBASIC. In this tutorial you will be taught to code in QBASIC. QBASIC stands for Quick BASIC. It has its own compiler and comes with its own IDE.


Each instruction of a QBASIC command is provided in a separate statement. Therefore, the complete program is composed of a sequence of statements. These statements are executed in order of there appearance in the program unless a deliberate 'jump' statement is given.

Every statement must appear in a separate line. A statement cannot exceed one line in length. Blank spaces and empty lines may be inserted where ever desired to improve the readability of the program.


  • QBASIC is user friendly.
  • QBASIC is flexible.
  • QBASIC is universally available.
  • QBASIC's commonly used features are standard.

Getting Started

  1. Run the application QBASIC.exe
  2. Go to FILE and click on NEW.
  3. A new window will appear named UNTITLED.BAS
  4. And you can start coding right away!

Character Set

The set of characters used in QBASIC is given in the table below.

Alphabets A, B, C, D................Y, Z
a, b, c, d..............y, z.
Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Special Symbols ~ ! @ # $ % ^ & * ( ) _ + | - = \ ` [ ] { } : " > < ? , . / ; ' [ ]


Numerical quantities in QBASIC are referred to as constants. They can be of two type integer and decimal. Some points about constants that have to be kept in mind.

  • Commas cannot appear anywhere in numbers.
  • A number can be preceded by a + or - sign.
  • A number cannot contain an exponent. Though, exponents can be expressed by the letter 'E' which replaces the base 10. (E.g. 1.2*10-3 = 1.2E-3).
  • A constant can have at most 9 significant figures.
  • The constant can have value ranging from 10-38 to 1038 including 0.


0		=	+0			=	-0
1		=	+1			=	0.1E+1
-5280	=	-5.280E+3	=	-.5280E4
3000000=	3E6			=	3 E+6 


A string is a sequence of characters (alphabets, digits and special symbols). Black spaces may be included in a string but not quotation marks (""). Some versions of QBASIC allows up to 4095 characters in a string.


X1= 123
Enter the value of a:
Do you wish to continue?


  • A variable is a name that represents a number or a string.
  • To represent a numerical variable letter can be used.
  • To represent a string variable the letter has to be followed by a dollar sign.


Numerical variable
A	g	H1	kI8		NUM9
String variable
A$		bs$		name$	ADD$ 


Special symbols are used in QBASIC to represent arithmetical, logical and comparison operations.

Arithmetical operators

  • Addition +
  • Subtraction -
  • Multiplication *
  • Division /
  • Exponential ^

Comparison operators

  • Equal to =
  • Not equal to <>
  • Less than <
  • Less than equal to <=
  • Greater than >
  • Greater than equal to >=


  1. Parenthesis ( )
  2. Exponential
  3. Multiplication & division
  4. Addition & subtraction

Assigning values - The LET statement

The LET statement is used in assigning values to a numerical or string variable. We can define a variable in this manner in a program.


LET variable = value


LET A = 12

Taking an Input from the user - The INPUT statement

The input statement is used to enter a numerical or string data during the program execution.


INPUT variable
INPUT "your string goes here"; variabale


INPUT "Enter the value of X "; A 

Displaying the Output - The PRINT statement

The PRINT statement is used to display a data on the output screen. The output data can be numbers, strings or formulas. Successive item must be separated by semicolon (;) or commas (,).


PRINT "your output goes here"
PRINT variable 


PRINT "This is a test run"

Terminating the program - The END statement

The END statement is used to end a program. The program does not execute after it encounters an END statement.



About the Author:

No further information.


No comment yet. Be the first to post a comment.