Qbasic Tutorial - QBasic for Beginners - Chapter 1 (2024)

Table of Contents
Quick View Beginners Chapter I FAQs

Quick View

QBasic for Beginners

QBasic Tutorials: QBasic for Beginners, Chapter 1 - Basic Commands with QBasic: PRINT, Variables, INPUT, GOTO.

by Author: Maxim Kakitsev

Created on 26.03.01

Chapter I

Basic Commands

When you open QBasic, you see a blue screen where you can type your program.
Let’s begin with the basic commands that are important in any program.


Command PRINT displays text or numbers on the screen.
The program line looks like this:

PRINT "My name is Nick."

Type the highlighted text into QBasic and press F5 to run the program. On the screen you’ll see:

My name is Nick.

You must put the text in quotes, like this – "text". The text in quotes is called a string. If you put the PRINT alone, without any text, it will just put an empty line. PRINT can also put numbers on the screen. PRINT 57 will show the number 57. This command is useful for displaying the result of mathematical calculations. But for calculations, as well as for other things in the program, you need to use variables.


When you think, you keep words or numbers in your mind. This allows you to speak and to make calculations. QBasic also needs to keep words or numbers in its memory. To do this, you use variables, pieces of QBasic memory, which can keep information. A variable can be named with any letter, for example – a. It can also have a longer name, which can be almost any word. It is important to know that there are two main types of variables – that keep a number and that keep a word or a string of words.

Numeric variables. It’s basically variables named with just a letter or a word. You tell this variable to keep a number like this:

a = 15

In other words, you assigned the value 15 to the variable a.
QBasic will now know that the variable named a keeps the number 15. Now, if you type:


and run the program, the computer will show this number on the screen.

String variables can keep so called "strings", which is basically any text or symbols (like % or £), which you put in the quotes "". You can also put numbers in a string variable, but again, you must include them in quotes, and QBasic will think that those numbers are just a part of text. The string variables look like this – a$. The $ sign tells QBasic that this variable contains text.


a$ = "It is nice to see you"PRINT a$

On the screen you’ll see:

It is nice to see you

The PRINT command can print more that one string on the line. To do this, put the ; sign between the variables. For example, you have two variables – name$, which contains name Rob, and age, which contains the number 34. Then, to print both name and age, you type:

PRINT "Name - "; name$; ". Age - "; age

As you can see, the name of a variable can be more than just one letter – it can be a short word which describes what sort of information does this variable keep.

What you see on the screen when you run the program will look like this:

Name – Rob. Age – 34

Or, you can type the program like that:

PRINT "Name - "; name$PRINT "Age - "; age

The result is:

Name – RobAge – 34


INPUT is a command that allows you or anybody else who runs the program to enter the information (text or number) when the program is already running. This command waits for the user to enter the information and then assigns this information to a variable. Since there are two types of variables, the INPUT command may look like this – INPUT a (for a number), or INPUT a$ (for a string).
Example (Type this program into QBasic and run it by pressing F5)

PRINT "What is your name?"INPUT name$PRINT "Hi, "; name$; ", nice to see you!"PRINT "How old are you?"INPUT age
PRINT "So you are "; age; " years old!"END

The END command tells QBasic that the program ends here.

You don’t have to use PRINT to ask the user to enter the information. Instead, you can use

INPUT "Enter your name"; name$

and the result will be the same.


Quite often you don’t want the program to run exactly in the order you put the lines, from the first to the last. Sometimes you want the program to jump to a particular line. For example, your program asks the user to guess a particular number:

~ ~ ~ ~ 'some of the program hereINPUT "Guess the number"; n~ ~ ~ ~ 'some of the program there

The program then checks if the entered number is correct. But if the user gives the wrong answer, you may want to let him try again. So you use the command GOTO, which moves the program back to the line where the question is asked. But first, to show QBasic where to go, you must "label" that line with a number:

1 INPUT "Guess the number"; n 'this line is labelled with number 1

Then, when you want the program to return to that line, you type


You can use GOTO to jump not only back but also forward, to any line you want. Always remember to label that line. You can have more than one label, but in that case they should be different.

Qbasic Tutorial - QBasic for Beginners - Chapter 1 (2024)


How to use QBasic for beginners? ›

Click on START (Located on the bottom left of your screen) – Click on ALL PROGRAMS – click on: SHORTCUT TO MICROSOFT QUICK BASIC. This will open the editor. Press on the ESC (escape) key to clear the screen and exit the Survival guide. To exit the QBasic editor, Click on the FILE menu, scroll down and click on EXIT.

What is QBasic for kids? ›

QBASIC is a programming language that stands for Quick Beginner's All-purpose Symbolic Instruction Code. It was developed by Microsoft as a quick and easy way for beginners to learn programming, and it was included with several versions of the Microsoft Windows operating system.

What is the QBasic answer? ›

Answer: Quick Beginner's All-Purpose Symbolic Instruction Code would be the official name of QBasic. This has been utilised in computing and programming languages all over the world. Quick Beginner's All-Purpose Symbolic Instruction Code (QBasic) is a Microsoft-designed variation of the popular BASIC coding language.

Is QBasic easier than Python? ›

In terms of syntax, Python is often favored for its simplicity and readability. Its clean and elegant syntax allows developers to write code that is both concise and expressive. On the other hand, QBasic has a more traditional syntax, which can be considered more verbose and less intuitive for beginners.

Is QBasic still used? ›

Current uses

Today, programmers sometimes use DOS emulators, such as DOSBox, to run QuickBASIC on Linux and on modern personal computers that no longer support the compiler. Alternatives to this include FreeBASIC and QB64, but they cannot yet run all QBasic/QuickBASIC programs.

What does the Q in QBasic stand for? ›

The full form of QBASIC is Quick Beginner's All-Purpose Symbolic Instruction Code.

Why is QBasic popular among beginners? ›

QBASIC, short for Quick Beginners All-purpose Symbolic Instruction Code, is a high-level programming language developed by Microsoft in the early 1980s. It was designed to be user-friendly, making it an excellent choice for beginners who want to learn the fundamentals of programming.

What is the keyword list of any five QBasic keywords? ›

Keywordsare formed by using characters of QBASIC Characters Set. Keywords are statements, commands, functions (built in functions) and names of operators. The keywords are also called Reserved Words. Some reserved words are CLS, REM, INPUT, LET, PRINT, FOR, DO, SELECT, MID$, ASC, SQR, LEN, LEFT$, TIME$ and INT.

What are the two types of QBasic? ›

There are two types of variables in QBasic: numeric and string. A numeric variable can further be broken down into three categories: integer, single precision, or double precision and is capable of storing numeric values. A string variable is capable of storing character string values.

What are QBasic statements examples? ›

A statement is a computer instruction written in a source language, such as QBASIC, which is converted into one or more machine code instructions by a compiler. The commonly used QBASIC statements are: LET, PRINT, INPUT, CLS, END and REM. In QBASIC, the LET statement is used to assign a value to a variable.

What is the conclusion of QBasic? ›

In conclusion, programming in QBASIC serves as an excellent starting point for beginners in the field of computer programming. It introduces essential programming concepts, offers an interactive learning environment, and provides a solid foundation for further exploration and development in the world of programming.

What are the rules of QBasic? ›

All QBasic programs are made up of series of statements, which are executed in the order in which they are written. Every statement should have at least one QBasic command word. ... All the command words have to be written using some standard rules, which are called “Syntax Rules”.

What are the 3 types of operators in QBasic? ›

There are four types of operators in QBASIC. They are Arithmetic Operators,Relational Operators, Logical Operators and Sting Operator. Arithmetic Operators are used to perform mathematical calculations like addition,subtraction, division, multiplication and exponential.

What is the end statement in QBasic? ›

END: END command is used to terminate a QBasic program. This statement is written at the end of a program to let the computer know that it is the end of the program and to terminate the process.

How do I start QBasic on my laptop? ›

QBasic on your Computer
  1. Find the Command Prompt on your computer. If you are running DOS, this is the prompt that asks you for commands. ...
  2. When you get a window with the prompt, enter the command: qbasic then press the ENTER key.
  3. QBasic should start up. The pictures in CHAPTER 1 show what you should see.

What are the three steps of programming in QBasic explain it? ›

Answer. Answer: QBasic is a simple programming language developed by Microsoft to type, edit, debug and execute BASIC programs.

Which key is used to run QBasic? ›

Explanation: F5 key is used to execute or run a QBasic Program.

Top Articles
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 5351

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.