0% found this document useful (0 votes)
13 views2 pages

Week 9 - Basic Programming Language

The BASIC programming language, developed in 1964, is designed for beginners and includes a specific character set, arithmetic and relational operators, and various data types such as integers, real numbers, booleans, and strings. Keywords in BASIC serve special functions, including input, output, and variable assignment, while variables can change values and constants cannot. To declare variables, the 'DIM' keyword is used, following specific naming rules.

Uploaded by

cahill.dokun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Week 9 - Basic Programming Language

The BASIC programming language, developed in 1964, is designed for beginners and includes a specific character set, arithmetic and relational operators, and various data types such as integers, real numbers, booleans, and strings. Keywords in BASIC serve special functions, including input, output, and variable assignment, while variables can change values and constants cannot. To declare variables, the 'DIM' keyword is used, following specific naming rules.

Uploaded by

cahill.dokun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

BASIC PROGRAMMING LANGUAGE

The BASIC programming language was developed in 1964 by John G. Kemeny and Thomas
Kurtz at Dartmouth College. BASIC is an acronym that stands for “Beginner’s All-Purpose
Symbolic Instruction Code”
BASIC CHARACTER SET
A character set is simply a list of letters, numbers and symbols that provide one with the
characters used in a particular language. BASIC as a language has its own character set, they
include the following:
 Alphabets characters (A to Z or a to z)
 Numeric character (0, 1 to 9) including hexadecimal characters.
 Special characters that perform special functions in BASIC
Arithmetic operators
CHARACTER NAME USES
* Asterisk For multiplication, e.g. A*B or (3*5)
- Minus For subtraction, e.g. M-N or (4-1)
+ Plus For addition, e.g. K+N or (1+6)
/ Forward slash For real division, e.g. A/B or (7/3)=2.33
\ Back slash For integer division, e.g. P\G or (7\3)=2
^ Caret For exponentiation, e.g. A^B or (7^3)
Relational (Comparison) Operator
CHARACTER NAME USES
= Equal to A=B
> Greater than A>B
< Less than A<B
>= Greater than or Equal to A >=B
<= Less than or Equal to A <= B
DATA TYPES
Data type is a description of the set of values and the basic set of operation that can be applied
to values of the type.
i) Integers: a positive or negative number without decimal. It has a range of values from -
32,768 to 32,767. Each value is stored using 2 bytes of memory (storage) space.
ii) Real numbers: numbers with fractional parts or with a decimal point. It is stored using 4
bytes of memory space.
iii) Boolean: consist of only two values; “YES and NO” or “True or False” or 1 or 0.
iv) String: a sequence of characters in double quote. For example, “Computer Studies” is a
string value with 16 characters. Each character is stored using 8 bits (one byte) in the ASCII
character set and two byte in the UNICODE character set. Alphabet is represented in ASCII.

BASIC KEYWORD
Keywords are words that have special meaning and function in BASIC. Such words must be
used strictly according to their functions, otherwise the computer will respond with error
message.
Here are some of the BASIC keywords and their uses
KEYWORDS USES EXAMPLE
Make comment about an instruction or 10 REM Program to add two
REM
about the whole program numbers
Used to ask the user to supply the data to be
INPUT 5 INPUT A,B,C
processed while the program is executing
Used to display the output of operation on
PRINT PRINT “The values”, A,B
the screen
LET Used to assign a value to a variable 3 LET A=5
Used to tell the computer that the data to be
processed is supplied within the
READ 10 READ A,B
program statements. Used together with
DATA keyword
Used to show the computer the data it is
DATA asked to read in the READ statement. Used 10 DATA 4,7
along with READ keyword.
END To end the program 5 END
VARIABLES AND CONSTANT
Variable is an identifier or a name of a memory location where data (values) can be placed or
stored, this type of data can be changed at any time during programming However, when the
value of a memory location is not to be changed, we refer to such memory location as
“constant”.
DECLARATION OF VARIABLES AND CONSTANTS
To set/declare a variable, the data type must be specified by using the keyword “DIM”
(Dimension).
This can be written in BASIC as follows:
1. DIM Char Name, INT Age, REAL Height
RULES FOR NAMING VARIABLE
1. Every variable must begin with an English alphabet (A to Z or a to z).
2. The name must not be more than 40 characters in length.
3. Names can be alphanumeric (combinations of alphabet and numbers).
4. Name must not be any keyword
5. Do not include a blank space in the name

You might also like