BASIC Statements and Arrays Group 6
BASIC Statements and Arrays Group 6
GROUP: Group 6
COURSE CODE: CSC 111
COURSE TITLE: Introduction to Essential Programming Language
Brief History of BASIC: BASIC stands for Beginner's All-purpose Symbolic Instruction
Code. It was developed in 1964 by John G. Kemeny and Thomas E. Kurtz at Dartmouth
College in the United States.
At that time, most programming languages were complex and difficult to learn, especially for
students who were not studying mathematics or engineering. Kemeny and Kurtz wanted to create
a language that would make programming easier and more accessible to beginners, especially
students in other fields.
BASIC was originally created to run on Dartmouth’s time-sharing computer system, allowing
multiple users to write and run programs simultaneously. It became one of the most popular
programming languages in the 1970s and 1980s, especially with the rise of personal computers
like the Apple II and early Microsoft systems.
As computers became more widespread, BASIC helped millions of people take their first steps
into programming.
Why Was BASIC Created? BASIC was created to make computer programming simple and
accessible to beginners—especially students who were not majoring in science, technology,
engineering, or mathematics.
Relevance and Usage Today: BASIC remains relevant in Nigerian education today, especially in
secondary schools and introductory computer science courses, because of its simplicity and
effectiveness in teaching programming fundamentals. It is part of the curriculum approved by
examination bodies like WAEC and NECO, making it a common starting point for students
learning to code. It's easy-to-understand syntax helps beginners grasp key programming concepts
such as variables, loops, and conditional statements. Additionally, BASIC runs well on low-spec
computers, which is ideal for many Nigerian schools with limited resources. Overall, BASIC
continues to play an important role in building logical thinking and foundational coding skills
among students.
BASIC Statements Introduction
BASIC statements are the individual instructions that tell the computer what actions to perform
in a BASIC program. Each statement is written on a separate line (usually with a line number)
and serves a specific purpose such as displaying output, taking input, making decisions, or
repeating tasks. They form the building blocks of every BASIC program.
● Evaluating Statements
These are used to perform calculations or assign values to variables. They are fundamental for
setting up data in the program, e.g., LET A = 5+2
● Executable Statements
These statements cause the program to perform a specific action, such as printing output, jumping
to another line, or ending the program. Actions like PRINT or GOTO.
● Input/Output Statements
These statements allow interaction between the program and the user. Read or display data, e.g.,
INPUT, PRINT
Common BASIC Statements
10 INPUT A
20 LET B = A * 2
40 END
Control Flow in BASIC
Conditional Statements:
Looping Statements:
An array is a data structure that allows you to store multiple values in a single variable. Instead
of creating individual variables for each piece of data, an array lets you group them together.
Declaring Arrays:
In BASIC, declaring an array involves specifying the name of the array and the number of
elements (size) it will contain. The DIM statement is used to declare arrays.
Types of Arrays:
Example:
DIM A(5) – This creates an array with 5 elements.
Example:
DIM A(3, 3) – This creates a 3x3 matrix of values, where you can access each element using two
indices, like A(1,1) for the value in the first row and first column.
Syntax:
Accessing Elements:
Example Program:
10 DIM A(5)
20 FOR I = 1 TO 5
30 INPUT A(I)
40 NEXT I
50 FOR I = 1 TO 5
60 PRINT A(I)
70 NEXT I
● Efficient Data Management: Arrays allow you to handle large amounts of data without
creating numerous individual variables.
● Easy Access to Data: You can easily access or modify values using their index.
● Compact Code: Arrays make your code more compact and organized, especially when
dealing with related data.
In summary, arrays are powerful tools for storing and organizing multiple pieces of data in
programming, making it easier to work with large datasets.
Combining Statements and Arrays
Building a Small Application:
20 FOR I = 1 TO 5
30 INPUT SCORES(I)
40 NEXT I
50 SUM = 0
60 FOR I = 1 TO 5
80 NEXT I
110 END
Conclusion and References
Importance of Learning BASIC:
Sources Used:
● https://nou.edu.ng/coursewarecontent/CIT%20132.pdf?utm