Welcome to Class !!
We are eager to have you join us !!
In today’s Computer Science class, We will be discussing the Basic Programming Language. We hope you enjoy the class!
BASIC PROGRAMMING LANGUAGE
BASIC is an acronym for “Beginners All-purpose Symbolic Instruction Codes. ” it was a language designed to teach beginners the construct and theory of programming language.
It was developed by two students during their academic years in Dartmouth College, USA under the direction of professors John G. Kemeny and Thomas E. Kurtz.
Versions of BASIC
- Q BASIC (Quick BASIC)
- BASIC (Visual BASIC)
BASIC Character Set
A character denotes any letter, digit, punctuation symbols or any other sign used in the representation of information in any language.
BASIC has the following character set:
- Alphabetic: A, B, C, …, Y, Z.
- Numbers: 0, 1, 2, 3, 4, …, 9
- Special Characters: ^, *, /, -, +, ( ), <, >, %, !, &, ?, etc.
In BASIC, programs are written in lines and each line starts with a line number which is a label of that particular line. Each of the lines is called a STATEMENT.
The line number can vary between 1 and 9999. The computer carries out (executes) statements in the order in which they are numbered.
Below are common BASIC keywords that are used to form a BASIC program.
CLS (Clear Screen):
It helps to clear the screen. Every BASIC program must begin with CLS to avoid getting an unexpected display on the screen.
It helps to make remarks or comments which make the program more readable. Any BASIC statement that begins with REM is not executed.
10 REM “This program will calculate the average of two numbers”.
It helps to assign a value of an expression to a variable.
10 LET A = 10
20 LET B = “OGUN”
30 LET C = B^2
40 LET D = B + C – 5
The above program is the same as:
10 A =10
20 B = “OGUN”
30 C = B^2
40 D = B + C – 5
Note that the use of LET is optional in BASIC.
It works hand in hand with a DATA statement. The READ statement reads/takes values from the DATA statement and assigns them to the variable after READ.
10 READ A, B, C
20 DATA 20, 30, “Chelsea”
40 PRINT A, B, C
Note that the READ statement is used instead of an INPUT statement when a large amount of data is involved. INPUT and READ statements cannot be used at the same time in a particular program.
It allows a value, numeric or string characters to be typed into the computer via the keyboard and stored in the memory of the computer at the specified data name.
20 INPUT A
It is used with the READ statement to hold constants to be read during program execution. DATA statements are non-executable and can be placed anywhere in a program.
The items in the DATA statements are first to last and are assigned in order to the variables found in the READ statement.
It is an output statement that allows a literal to be specified to be printed on the monitor or printer e.g. 30 PRINT “Learning programming is fun”. (This line will print “Learning programming is fun” on the monitor and returns the cursor to the next line).
This indicates the end of a BASIC program. It is compulsory otherwise the program will have no end.
We have come to the end of this class. We do hope you enjoyed the class?
Should you have any further question, feel free to ask in the comment section below and trust us to respond as soon as possible.
In our next class, we will be talking about Graphics Packages. We are very much eager to meet you there.
For more class notes, videos, homework help etc download our Mobile App HERE
Join ClassNotes.ng Telegram Community HERE for exclusive content and support