Introduction to Qbasic

QBasic is probably the best language to learn basic programming principles. It is easy to learn and easy to use. This allows the student to worry more about how programming works than how to work the compiler, or interpreter in this case. The general intent of this tutorial is to allow those interested in programming in QBasic to quickly and eaisly learn the general syntax of the language, as well as help those that just need a couple of pointers to aid in the development of programs or learning the language.

The main intent of the first part of this tutorial is to give those that don't know much about programming at all a foundation to stand on for the real guts of the lanugage. I hope that you find all of this helpfull.
So, here is what I have, and what I know, if you have any questions please e-mail them to me.

Getting Started:

It always helps if, at the beginning of the program, you place comments to tell the name of the program, who wrote it and maybe what it's purpose is. Comments are special characters that tell the interpreter not to execute that line. This is usefull because you can also include comments throughout your program to describe what is happening. In QBasic you can comment in two different ways:

1) REM

2) '

The proper usage of these would be:

� � � � REM This program was written by Sir Nable

� � � � ' This program was written on july 17, 1901

Either of these will work fine, use whatever is eaiser to read.

Generally, at the start of a program, you would clear the output screen by using 'CLS' which stands for CLear Screen. This statement can be placed anywhere you want the output screen to be cleared. At the end of a program you need to tell the interpreter that you are done, so you would use END or SYSTEM. The END statement is obvious, but SYSTEM is not, I will go into the differences later. So, a very general do-nothing program would look like:

'This program was written on 1/1/1111 by John Smith
CLS

'My Code is here

END

For simplicity in future examples, I will omit all of these statements, but they should be included when you try to run the examples. Also, something to note is that in the future all references to the word 'code' mean all of those things that the interpreter can understand and run, like the PRINT statement.

� � Back � � � � Tutorial Part 1 � � � � Next � �