Skip to content
HeadTeacher.ng
Lesson Notes

BASIC Programming, FOR-NEXT Statements and Simple Programs for SS 3

BASIC Programming, FOR-NEXT Statements and Simple Programs for SS 3. This SS 3 lesson covers review of the for next statement, while end statement: write basic program.

Royal AlikorByRoyal AlikorPublishedSep 15, 2026Reading8 minComments0

Note for teachers using this lesson plan

This lesson focuses on reinforcing students’ understanding and practical application of FOR-NEXT and WHILE-END loop statements in BASIC programming. Ensure you have a computer with a BASIC interpreter (or a projector to display code) ready to demonstrate program execution. Guide students through writing and tracing simple programs, emphasizing the syntax and logic of each loop. By the end of the lesson, students should be able to confidently write BASIC programs that utilize these looping constructs for repetitive tasks.

Class: SS 3
Term: First Term
Week: 8
Age: 16 years
Duration: 45 minutes
Subject: Computer Science
Topic: BASIC PROGRAMING III
Curriculum Theme: Programming
Previous Lesson: CorelDRAW Graphics and One-Dimensional Arrays
Subject Matter: Review of the for next statement, while end statement: Write BASIC program

Specific Objectives

By the end of the lesson, pupils/students should be able to:

Cognitive Domain

  • Recall the syntax and function of the FOR-NEXT statement.
  • Recall the syntax and function of the WHILE-END statement.
  • Explain the difference between FOR-NEXT and WHILE-END loops.

Psychomotor Domain

  • Write simple BASIC program segments using FOR-NEXT.
  • Write simple BASIC program segments using WHILE-END.
  • Develop a BASIC program to store data in a vector using a FOR-NEXT loop.
  • Develop a BASIC program to calculate the average of a one-dimensional array using a loop.

Reference Materials

The following resources were used in planning this lesson:

  • 2025 Revised 9 Years Basic Education Curriculum
  • Relevant State Unified Scheme of Work
  • Computer Science for Senior Secondary Schools textbook
  • The HeadTeacher Scheme of work

Instructional Materials

The teacher will teach this lesson with the aid of:

  • Whiteboard and markers
  • Computer with a BASIC interpreter (e.g., QBASIC) or a projector to display code
  • Prepared BASIC program examples
  • Chart showing syntax of FOR-NEXT and WHILE-END statements

Rationale for the Lesson

This lesson is important for students to master fundamental programming control structures. Understanding FOR-NEXT and WHILE-END loops enables students to write efficient programs that handle repetitive tasks, which is a core skill in any programming language. It builds a strong foundation for more complex algorithms and problem-solving in computer science.

Prerequisite/Previous Knowledge

Students should have prior knowledge of basic programming concepts, including variables, data types, input/output statements, and an introductory understanding of BASIC programming.

Lesson Content/Board Summary

BASIC PROGRAMING III

Review of the FOR-NEXT Statement

The FOR-NEXT statement is a control flow statement for specifying iteration, which allows code to be executed repeatedly. It is used when the number of iterations is known in advance.

Syntax:

FOR variable = start TO end [STEP increment]
    ' Statements to be executed
NEXT variable

Example: Program to print numbers from 1 to 5.

10 CLS
20 FOR I = 1 TO 5
30    PRINT I
40 NEXT I
50 END

Review of the WHILE-END Statement

The WHILE-END (or WHILE-WEND) statement is a control flow statement that executes a block of code repeatedly as long as a specified condition is true. It is used when the number of iterations is not known beforehand, and the loop continues based on a condition.

Syntax:

WHILE condition
    ' Statements to be executed
WEND

Example: Program to print numbers from 1 to 5 using WHILE-WEND.

10 CLS
20 I = 1
30 WHILE I <= 5
40    PRINT I
50    I = I + 1
60 WEND
70 END

Writing BASIC Programs with Loops

Program to State Data in a Vector (Array) of 10 Integers

Using FOR-NEXT statement:

10 CLS
20 DIM VECTOR(10) ' Declare an array of 10 elements
30 PRINT "Enter 10 integer values:"
40 FOR I = 1 TO 10
50    INPUT VECTOR(I)
60 NEXT I
70 PRINT "Values in the vector are:"
80 FOR I = 1 TO 10
90    PRINT VECTOR(I)
100 NEXT I
110 END

Without FOR-NEXT statement (direct assignment for illustration):

10 CLS
20 DIM VECTOR(10)
30 VECTOR(1) = 10
40 VECTOR(2) = 20
50 VECTOR(3) = 30
60 ' ... and so on for all 10 elements
70 VECTOR(10) = 100
80 PRINT "Values in the vector are:"
90 PRINT VECTOR(1)
100 PRINT VECTOR(2)
110 ' ... and so on for all 10 elements
120 PRINT VECTOR(10)
130 END

Note: Using a FOR-NEXT loop is much more efficient and practical for handling larger numbers of elements compared to direct assignment.

Program to Calculate the Average of a One-Dimensional Array with 100 Numeric Values
10 CLS
20 DIM SCORES(100) ' Declare an array for 100 scores
30 TOTAL = 0       ' Initialize total sum
40
50 ' Input 100 numeric values into the array
60 PRINT "Enter 100 numeric scores:"
70 FOR I = 1 TO 100
80    INPUT SCORES(I)
90    TOTAL = TOTAL + SCORES(I) ' Add each score to total
100 NEXT I
110
120 ' Calculate the average
130 AVERAGE = TOTAL / 100
140
150 ' Display the total and average
160 PRINT "Sum of scores: "; TOTAL
170 PRINT "Average score: "; AVERAGE
180 END

Teaching Methods/Instructional Techniques

Discussion, Demonstration, Guided Practice, Question and Answer, Explanation, Practical Activity

Instructional Procedures

Step 1: Introduction

Time: 5 minutes

Teaching Skill: Activating Prior Knowledge

Teacher’s Activity: The teacher greets the students and asks them to recall what they learned about basic programming statements in previous lessons, specifically focusing on any statements used for repetition or loops.

Pupils’ Activity: Students respond by mentioning concepts like variables, input/output, and possibly simple conditional statements.

Learning Point: Prior programming knowledge

Step 2: Review of FOR-NEXT Statement

Time: 8 minutes

Teaching Skill: Explanation/Demonstration

Teacher’s Activity: The teacher explains the FOR-NEXT loop, its purpose, syntax, and how it works with a known number of iterations. The teacher writes the syntax and a simple example on the board.

Pupils’ Activity: Students listen attentively, ask questions for clarification, and copy the syntax and example.

Learning Point: FOR-NEXT statement review

Step 3: Application of FOR-NEXT in a Simple Program

Time: 7 minutes

Teaching Skill: Demonstration/Guided Practice

Teacher’s Activity: The teacher demonstrates a simple BASIC program using FOR-NEXT (e.g., printing numbers 1-10) on a computer or by tracing on the board. The teacher guides students to trace the execution flow.

Pupils’ Activity: Students observe the demonstration, participate in tracing the program, and suggest modifications.

Learning Point: FOR-NEXT program application

Step 4: Review of WHILE-END Statement

Time: 8 minutes

Teaching Skill: Explanation/Demonstration

Teacher’s Activity: The teacher explains the WHILE-END loop, its purpose, syntax, and how it works based on a condition. The teacher writes the syntax and a simple example on the board.

Pupils’ Activity: Students listen, ask questions, and copy the syntax and example.

Learning Point: WHILE-END statement review

Step 5: Application of WHILE-END in a Simple Program

Time: 7 minutes

Teaching Skill: Demonstration/Guided Practice

Teacher’s Activity: The teacher demonstrates a simple BASIC program using WHILE-END (e.g., a counter that stops when a condition is met) on a computer or by tracing on the board. The teacher highlights the condition-based execution.

Pupils’ Activity: Students observe the demonstration, participate in tracing, and identify the condition.

Learning Point: WHILE-END program application

Step 6: Guided Practice: Writing Programs for Vector and Array Average

Time: 5 minutes

Teaching Skill: Problem Solving/Collaboration

Teacher’s Activity: The teacher presents the problems of storing data in a vector and calculating an array average. The teacher guides students in pairs or small groups to brainstorm and outline the steps for writing these programs using the learned loop statements.

Pupils’ Activity: Students work in groups, discussing and outlining program logic for the given problems.

Learning Point: Loop programming practice

Step 7: Evaluation/Review

Time: 5 minutes

Teaching Skill: Questioning/Assessment

Teacher’s Activity: The teacher evaluates the learning by asking the following questions:

  1. State the syntax of the FOR-NEXT loop.
  2. When is it appropriate to use a WHILE-END loop instead of a FOR-NEXT loop?
  3. Write a BASIC program segment to print “Hello” 5 times using a FOR-NEXT loop.
  4. What is the purpose of the DIM statement in BASIC?

Pupils’ Activity: Pupils answer orally and in writing.

Learning Point: Loop statement understanding

Step 8: Note-Taking

Time: 4 minutes

Teaching Skill: Guided Writing

Teacher’s Activity: The teacher guides pupils/students to copy the essential Board Summary notes on FOR-NEXT and WHILE-END statements and program examples into their notebooks.

Pupils’ Activity: Pupils/students copy the notes carefully into their notebooks.

Learning Point: Loop programming notes

Step 9: Conclusion

Time: 1 minute

Teaching Skill: Reinforcement

Teacher’s Activity: The teacher briefly summarizes the importance of FOR-NEXT and WHILE-END loops in writing efficient and effective BASIC programs for repetitive tasks.

Pupils’ Activity: Students listen and acknowledge the summary.

Learning Point: Importance of loops

Continuous Assessment/Further Study

Type: Homework

Instruction: Answer the following questions in your notebook:

  1. Write a BASIC program that asks the user to enter 5 numbers and then prints the sum of these numbers using a FOR-NEXT loop.
  2. Modify the program from question 1 to use a WHILE-END loop instead.
  3. Explain in your own words the main difference between a FOR-NEXT loop and a WHILE-END loop.

Lesson Keywords

  • BASIC – Beginner’s All-purpose Symbolic Instruction Code, a high-level programming language.
  • FOR-NEXT – A loop statement used for a known number of iterations.
  • WHILE-END – A loop statement that repeats a block of code as long as a condition is true.
  • Loop – A programming construct that executes a block of code repeatedly.
  • Program – A set of instructions that a computer can execute.
  • Vector/Array – A collection of data items, all of the same type, accessed using an index.

Differentiation

For weaker learners: Provide simplified program examples and allow them to work in pairs. Offer extra guidance on tracing loop execution step-by-step. Focus on understanding the basic syntax before moving to complex problems.

For faster learners: Challenge them to write programs that incorporate both FOR-NEXT and WHILE-END loops, or to solve problems requiring nested loops. Ask them to consider error handling (e.g., what if a user enters non-numeric data).

Suggested Lesson Videos

For further understanding, search on YouTube for: BASIC FOR-NEXT WHILE-WEND loops SS3

Teacher Guide for Using This Lesson Plan

Before the lesson, ensure you have a working BASIC interpreter (like QBASIC) or clear visual aids to demonstrate code execution. Prepare simple, clear examples of FOR-NEXT and WHILE-END loops, as well as the programs for vector data and array average. Start by reviewing previous programming concepts to connect new learning. During the lesson, actively engage students by asking questions and encouraging them to predict program output. When demonstrating, explain each line of code clearly. For the guided practice, circulate among students to provide immediate feedback and support. Ensure students understand when to use each type of loop. The Board Summary should be copied by students after the main teaching points have been covered and evaluated, typically in Step 8. Check for common errors like incorrect loop conditions, missing NEXT or WEND statements, or off-by-one errors in loop ranges. Emphasize the practical application of loops in solving repetitive problems.

Export this post
BASIC Programming, FOR-NEXT Statements and Simple Programs for SS 3
Community Join the conversation Open discussion +