Article #48
Title: QBASIC: How to make a 'Hello World' program
Written By: Alex Powell

Back/Next

QBASIC (Quick BASIC) is a synthetic programming enviroment that comes standard with MS-DOS. If you had to buy an upgrade to get Windows 95, chances are you have QBASIC. To run QBASIC, just go to an MS-DOS prompt windows, type qbasic, and hit enter.

QBASIC, unlike the original BASIC, does not require line numbers (yeah!). Also, in QBASIC, just as in previous forms of BASIC, variables need not be explicitly defined as strings, integers, or decimal numbers.

In this 'Hello World' program we will clear the screen, assign the phrase "Hello World!" to a variable, move the cursor to the center of the screen, and then print the "Hello World!" variable to the screen.

CLS
phrase$ = "Hello World!"
LOCATE 13,40
PRINT phrase$
END

Notice: All string variables (variables that hold alphanumerics) must end in a '$'.
For more information on QBASIC and to receive helpful code snippets, go to the QBASIC Homepage.