A command or set of instructions used in the program is called statement. The statement performs specific task in the program. There are several different types statements in QBASIC Programming language. For example, CLS statement clears the screen, PRINT statement displays output and INPUT statement takes the input from the users. In this section we will learn some general statements of QBASIC Programming.
1. CLS
This statement is used to clear the output screen. Generally it is used at the starting of the program.
Syntax : CLS
2. REM
This statement is used to put comments in the program. It is non-executable statement. We can use (‘) instead of REM.
Syntax : REM
3. LET
It is an an assignment statement which is used to assign value to a variable. LET is an optional statement.
Syntax : Let =
4. PRINT
It displays output on the screen. We can also use question mark (?) instead of PRINT statement.
Syntax : PRINT
Or,
?
5. INPUT
The INPUT statement is used to accept data from the keyboard at the program execution time.
Syntax : INPUT ;
Example:
INPUT “Enter First Number”; x
INPUT “Enter Second Number”; y
PRINT “Sum of “; x; ” and “; y; ” is “; x+y
END
6. END
END statement is used to terminate the execution of the program. It stops the further processing of the program.
Syntax : END
7. READ …. DATA
This statement can process large number of data, where LET and INPUT statement can process only one data at once. This statement read the given value of DATA statement and store them with suitable variable.
Syntax : READ , , …
DATA , , …
Example :
READ x, y, z
av = (x+y+z)
PRINT “Average = “; av
DATA 10, 20, 30
END