BASIC PROGRAMMING (1)
BASIC PROGRAMMING (1)
BASIC STATEMENT
BASIC Statements are those BASIC keywords used in the program to perform certain function.
1. CLS,: This stands for clear screen. This statement is used to clear the screen of the computer monitor.
2. REM: This stands for remark. This statement is used to give comment to a program.
4. INPUT: This statement is used to assign a value to a variable during program execution. Eg,: INPUT A
5. READ and DATA,: READ statement states the variables while the DATA statement assigns values to
these variables.
Example: READ X, Y, Z,
DATA 7, 15, 12
Note: LET, INPUT, and READ and DATA Statements are assignment statements.
6. PRINT Statement: This is an output Statement used to display the result of a program.
BASIC data type is a classification of data which tells the compiler or interpreter how the programmer
intends to use the data.
The data type defined the operations that can be done on the data, the meaning of the data and the
way value of the type can be stored.
a. Integer: This is any positive or negative whole number. Eg: 25, 235, 2546, etc.
b. Floating Point numbers: These are numbers in which the digit and the location are treated separately.
Eg. 2.5 x 10
2. String: They are textual data enclosed in double quotation mark. For example,: "JOHNSON".
3. Boolean data type: A boolean data type is the data type that represents either true or false value, Yes
or No value or On or Off(1 or 0) value.
CONSTANTS
1. Numeric Constant
2. String Constant
1. Numeric Constant: These are values that are fixed throughout the program execution. They are
classified into two, namely;
a. Integer Constant: This cf whole numbers. Eg. 30, 75, 180, etc.
VARIABLE
A variable is a name that represents numeric quantity or a string. It is also a name that is used to
represent some storage location in computer memory.
1. Numeric Variables
2. String Variables
1. Numeric Variables: This is a variable that is used to store numeric data. It represents or stores a
number.
a. Integer Variable names: These are written with % sign as the last character.
b. Single Precision Variable names: These are written with # sign as last character. Eg. UNIT#
2. String Variable: This is a variable that represents or stores a string data. String Variable names are
written with dollar sign ($) as last character.
Example: NAME$ = "TUNDE"
2. A variable name must not contain any special character which include mathematical operators,
commas, blank space, question mark, etc.
3. A QBASIC reserved or keyword must not be used as a Variable name. Eg. REM, INPUT, PRINT etc.
4. A Variable name may contain numeric digit. Eg. RITA3, PURUTY2, etc.
BASIC OPERATORS
An operator is a symbol used to carry out operations in any program in BASIC Programming language.
An operator acts an data items called operands.
(a) ARITHMETIC OPERATORS: These are symbols used for various mathematical calculations.
(b) RELATIONAL OPERATORS: These are symbols used to compare different operands. They produce
logical results. Eg. =, <, >, <>,
(c) LOGICAL OPERATORS: These are BASIC operators that produce logical answers when two logical
expressions are compared. Eg. AND, OR, NOT, etc
(d) STRING OPERATORS: String Operator joins two or more character strings into a single character string
through the process known as a string concatenation. Eg. "Good" "+" "Morning" will give the result.
Good morning.