BASIC PROGRAMMING LANGUAGE CONTINUES
BASIC KEY STATEMENTS
Statement is a set of instruction written by using key words or commands of QBASIC. Some common BASIC keywords
used to form BASIC statements are;
- Line number
- CLS statement
- Remark statement
- Assignment statement
- Output statement
- Program terminator, etc.
LINE NUMBER:
Every BASIC statement must begin with a line number which can vary between 1 and 9999. Instructions are carried out
or executed in the order in which they are numbered. E.g.
10 INPUT A
20 INPUT B
30 LET C = A + B
40 END
CLS STATEMENT:
The CLS statement clears the screen. The syntax is CLS and it is used for clearing unexpected display on the screen.
E.g.
10 CLS
20 REM “This program will calculate the total of two numbers”
30 INPUT A
40 INPUT B
REMARK STATEMENT:
The remark statement is represented using “REM” . It is used to introduce the program to the computer and it is an
optional statement. E.g.
10 REM “This program will calculate the total of two numbers”
20 INPUT A
30 INPUT B
40 END
PROGRAM TERMINATOR:
The program terminator is used to specify the end point in a BASIC program. E.g.
END/STOP command
ASSIGNMENT STATEMENT:
Assignment statement is used to assign values to variables.
TYPES OF ASSIGNMENT STATEMENT
- LET statement
- INPUT statement
Week nine Computer Studies Lesson note for JSS2 1
- DATA statement
LET STATEMENT
This is an assignment statement used to assign value to a variable. E.g.
LET A = B
LET C = A+B
LET B$ = ”THANK YOU”
INPUT STATEMENT
The input statement allows a value, numeric or character string to be typed into the computer and stored in the
computer. E.g.
10 INPUT A
DATA STATEMENT
The READ and DATA statement work hand in hand. They are used instead of the INPUT statement when large amount
of data is to be entered into the computer. E.g.
10 READ A, B, C, D
20 DATA 20,30,40,50
OUTUT STATEMENT
The output statement is used to display the result of the task assigned to it. E.g. PRINT
30 PRINT “computer is a dummy”
CONDITIONAL STATEMENT
Conditional statements are dependent on certain conditions and criteria before they can be executed if conditions are
true or order actions may be taken if conditions are false. E.g.
30 IF A > 80 THEN PRINT A
40 ELSE PRINT B
50 END
UNCONDITIONAL STATEMENT
Unconditional statements are statements used to transfer control from one part of the program to another. E.g.
GOTO and RETURN statements
10 CLS
20 INPUT A
30 INPUT B
40 LET C = A+B
50 GOTO 60
60 PRINT C
70 END
ASSIGNMENT
Mention 10 other key statements used in BASIC and state their uses.
Week nine Computer Studies Lesson note for JSS2 2
Week nine Computer Studies Lesson note for JSS2 3