QBasic language is a variant of Basic programming which was 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 looking for Qbasic commands or statements for class 6 and class 7, then this is the right article for you. Here we will discuss those basic commands and statements which 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 present-day operating system doesn’t have these external commands in Windows. To use those commands you have to install QBasic in windows first and then use it.
In this post, we will learn about both External QBasic commands and statements.
First, we need to understand what is 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 operating system, the QBasic commands are not in-built which means it doesn’t come pre-installed, so those QBasic commands are external commands. So we need to install QBasic in our computer which will then interpret those External QBasic Commands.
However, internal commands are those commands which are in-built windows commands. There is no need for any external files to interpret those commands. Internal commands are the same in all versions of Windows. Examples of Internal commands are del, mkdir, copy, cls, date, ren, vol etc. you can get all the commands by typing HELP in 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 program is called a statement. Some are commands are executable while some are non-executable commands. Executable statements are those that have a specific action while non-executable are the one 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.
|/B||It allows us to use a monochrome monitor with a color graphics card.|
|/EDITOR||It 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.|
|/MBF||It converts IEEE numbers to Microsoft-Binary-Format numbers.|
|/NOHI||This command allows us to use a monitor that does not support high Intensity.|
|/RUN|| To execute a QBASIC program. Syntax – [[drive:][path]filename].|
Example qbasic /run hello.bas. It will open the hello QBasic program.
List of QBasic Programming Statements
Here are some of the basic QBASIC statements list with syntax and examples.
1) PRINT: This command/statement prints the statement or data written after it on the output screen. If you want to print a sentence or string then you have put inside double quotes (“ ”) and if you want to print a variable or a number, you can just write after the PRINT command.
Syntax: PRINT <expression>
If it is a variable or a number,
PRINT age / PRINT 30
If it is a string,
PRINT “This is a Print command”
2. INPUT: this command is used to take data from a user. It can accept both string and number.
If the input data is a number than the variable name in which the number is to be store is written directly after the INPUT command.
Syntax: INPUT [“string”] variable
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
3.CLS: 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.
4.LET: This command is used to assign a value to a variable. The value can be a string or number.
Syntax: LET [variable] = [expression]
LET name = “john” or LET age = 12
5.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.
6.REM: This is a remark command. This is a non-executable statement. It is written within a single quote.
Syntax REM <remark>
7.LINE INPUT: This statement allows to input data at a time and assign it to a single variable.
Syntax: LINE INPUT “string”; string variable
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.
Some Important QBasic commands and QBasic Statements
What is input statement in Qbasic?
INPUT statement is used to take data from a user. It can accept both string and number. If the input data is a number than the variable name in which the number is to be store is written directly after the INPUT command.
What are keywords in Qbasic?
Keywords in Qbasic are special words that have a specific meaning in programming. Keywords can be a statement, command, or function. Some reserved keywords are CLS, REM, INPUT, PRINT, LET etc
What is QBasic 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 one which is used to specify arguments, initial value or provide characteristics to a data.
What is CLS Qbasic?
CLS command 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.