BASIC Programming Language

 

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 computer science classnotesng

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

  1. Q BASIC (Quick BASIC)
  2. GW-BASIC
  3. 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:

  1. Alphabetic: A, B, C, …, Y, Z.
  2. Numbers: 0, 1, 2, 3, 4, …, 9
  • Special Characters: ^, *, /, -, +, ( ), <, >, %, !, &, ?, etc.
BASIC Statements

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.

  1. CLS
  2. REM
  3. LET
  4. READ
  5. INPUT
  6. DATA
  7. PRINT
  8. END
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.

Example:

10 CLS

20 …

30 …

REM (Remark):

It helps to make remarks or comments which make the program more readable. Any BASIC statement that begins with REM is not executed.

Example:

10 REM “This program will calculate the average of two numbers”.

20 …

30 …

LET:

It helps to assign a value of an expression to a variable.

Example:

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.

READ Statement:

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.

Example:

10 READ A, B, C

20 DATA 20, 30, “Chelsea”

.

.

.

40 PRINT A, B, C

50 END

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.

INPUT:

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.

Example:

10 CLS

20 INPUT A

DATA Statement:

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.

PRINT 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).

END Statement:

This indicates the end of a BASIC program. It is compulsory otherwise the program will have no end.

Example:

10 PRINT

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

 

Pass WAEC, JAMB, POST-UTME & more in One Sitting for FREE!💃

Leave a Reply

Your email address will not be published.

Don`t copy text!