Qbasic Tutorial for beginners and children (Under Construction)


Two BASIC reserved words

It is not necessary for you to know all the BASIC reserved words to get started. You could write a lot of  programs using about 10 keywords. To get started we'll be using only two of them:

CLS This statement is used to clear the screen.
PRINT The PRINT statement is used to display data on the screen.

 

Your First BASIC program

To begin we will write a simple program that will output a text on the screen.

Type the following in the untitled window:

PRINT "Hello!"
PRINT "This is my first BASIC program."

To run your program:

Click on Run Start

or

Press the function key F5

The output on the screen will be as follows:

Hello!
This is my first program.

 

 

 

 

 

 

 

Press any key to continue

Once the execution of your program is completed, BASIC will display a "Press any key to continue" message on the screen. So press any key to return to your programming environment.

If you run your program many times, you will notice that the same text will be displayed several times on the screen as shown below:

Hello!
This is my first program.
Hello!
This is my first program.
Hello!
This is my first program.
Hello!
This is my first program.

 

 

 

 

Press any key to continue

To get your screen cleared each time you run you program, put the CLS statement at the beginning of your program:

CLS
PRINT "Hello!"
PRINT "This is my first BASIC program."

Note the presence of inverted commas(" ") in the PRINT statement. Always put inverted commas if you want to output sentences or characters. We will be discussing more about it in Chapter 3.

[ Previous Index Next ]


pages viewed since January  19 2002