QBasic Commands and Statements-2023

QBasic language is a variant of Basic programming developed by Microsoft in 1985. It was developed to make computer programs and various utilities for MS-DOS and windows 98/95 Operating system. It is easy to code and very easy to understand.

If you are searching for Qbasic commands for class 6 or Qbasic statements for class 7, then this is the right article for you.

Here in this post, we will learn about basic commands and statements that will help you to understand the concept of how a computer understands what you have programmed.

If you want to know about Qbasic check QBASIC Programming – Beginner’s Friendly

QBasic commands are available as an external command in the following version of Microsoft Operating Systems:

  • All Versions of MS-DOS
  • Windows 95 and
  • Windows 98

However, the modern operating system(Windows 10, 11) doesn’t have these external commands built-in. To use the qbasic commands you need to install QBasic in windows first.

Here in this article, we will talk about both External QBasic commands and QBasic statements.

First, let us understand what are external and internal commands and Qbasic Statements.

What are External and Internal Commands?

External commands are those commands which are not in-built in MS-DOS or Windows. To read those external files we need an internal file that can interpret those commands. In a modern-day operating system, the QBasic commands are not in-built so those QBasic commands are external commands. We need to install QBasic on our computer system that will then interpret those External Commands.

However, internal commands are those commands that are in-built commands in your operating system like windows. There is no need for any external software or files to interpret those commands.

The internal commands are the same in every windows version. Examples of Internal commands are del, mkdir, copy, cls, date, ren, vol etc. you can get all the commands by typing HELP in the command prompt in windows.

All versions of MS-DOS and Windows have the same internal commands but may have different external commands.

What is a QBASIC statement/command?

A command or instructions in a QBASIC is called a statement. Some are executable commands while some are non-executable commands. Executable statements are those that have a specific action while non-executable are the ones which is used to specify arguments, initial value or provide characteristics to a data

Since we now know the meaning of external commands, let us see some of the External QBASIC Commands.

List of External QBASIC commands

First, start the MS-DOS QBasic environment.

CommandDescriptions
/BIt allows us to use a monochrome monitor with a color graphics card.
/EDITORIt starts the MS-DOS editor
/G Provides the fastest update of the CGA screen (works only with machines using CGA monitors). If you see some dot flickering on your screen that means your hardware cannot fully support this option.
/H display the maximum number of lines on your screen.
/MBFIt converts IEEE numbers to Microsoft-Binary-Format numbers.
/NOHIThis command allows us to use a monitor that does not support high Intensity.
/RUN To execute a QBASIC program. Syntax – [[drive:][path]filename].

List of QBasic Programming Statements

Here are some of the basic QBASIC statements listed with syntax and examples.

The PRINT command prints the data or text on the output screen. If you want to print a sentence or string then you have to put inside double quotes (“  ”) and if you want to print a variable or a number, write after the PRINT command.

Syntax: PRINT

Examples:

If it is a variable or a number,

PRINT age / PRINT 30

If it is a string,

PRINT “This is a Print command”

INPUT statement

The INPUT command is used to take data from a user. It can accept both strings and numbers.

If the input data is a number then the variable name is written directly after the INPUT command.

Syntax: INPUT [“string”] variable

Example:

INPUT year

And if the input data is a string then the variable name in which it is to be stored is written after INPUT command followed by $sign

Example:

INPUT name$

CLS Statement

CLS means clear screen. This command is used to clear the screen if there are some output or results on your screen that you want to clear or erase.

Syntax: CLS

LET statement

The LET command is used to assign a value to a variable. The value can be a string or number.

Syntax: LET [variable] = [expression]

Example:

LET name = “john” or LET age = 12

END Statement

The 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.

Syntax: END

REM statement

REM is a remark command. This is a non-executable statement. It is written within a single quote.

Syntax: REM

LINE INPUT statement

The LINE INPUT statement allows to input data at a time and assign it to a single variable.

Syntax: LINE INPUT “string”; string variable

Example:

LINE INPUT “please enter the data”; n$

So these are some of the basic Qbasic commands and Qbasic statements that will help you to get started with the programming language.


Related Articles:

Qbasic Control Statements with Examples

Download Qbasic (QB64) Free for Windows 10 and 11

Qbasic Programming Examples and Exercises

Qbasic Color statement

Qbasic Looping statements with Examples

Free QBasic Online Compilers – Online Editors

QBASIC Programming – Beginner’s Friendly

Scroll to Top