โ† Programming Logic for Web Developers ยท Lesson 4 of 4

Module Three

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
1

Course Outline

Programming Logic for Web Developers ยท Course Outline

๐Ÿง  Programming Logic for Web Developers

Course Outline ยท Beginner Friendly ยท 2026


๐Ÿ“˜ Course Overview

This short course teaches you how to think like a programmer. You will learn the basic logic that every web developer needs: breaking problems into steps, making decisions, repeating tasks, and organizing information. No coding experience needed.


๐Ÿ“‹ Course Details

Item Details
Level Beginner
Duration 3 weeks ยท 2โ€“3 hours per week
Modules 3 modules + 1 final project
Tools Pen and paper (a computer is optional)
Certificate Yes, after the final project

๐ŸŽฏ What You Will Learn

  • What programming logic means
  • How to break big problems into small steps
  • How to make decisions in code (if / else)
  • How to repeat tasks (loops)
  • How to store and use information (variables and data)
  • How to plan a simple program before writing it

๐Ÿ“š Course Modules

Module 1 โ€” Thinking in Steps

Learn what programming logic is and how to break a problem into clear, simple steps.

Topics

  • What is programming logic?
  • Steps, order, and sequence
  • Algorithms in everyday life
  • Flowcharts and pseudocode
  • Breaking a big problem into small steps

Learning Outcome

Write simple step-by-step instructions for a daily task.


Module 2 โ€” Making Decisions and Repeating Tasks

Learn how programs choose between options and how they repeat actions.

Topics

  • Conditions (if, else, else if)
  • True and false (Boolean logic)
  • Comparison operators (equal, greater than, less than)
  • Loops (repeat, while, for)
  • When to use a decision and when to use a loop

Learning Outcome

Describe a daily decision and a daily repetition using logic.


Module 3 โ€” Storing and Using Information

Learn how programs keep information and how they use it to solve problems.

Topics

  • Variables (boxes that hold information)
  • Data types (numbers, text, true/false)
  • Lists and arrays
  • Functions (reusable steps)
  • Input and output

Learning Outcome

Explain how a program stores and uses information to solve a task.


๐Ÿ† Final Project โ€” Plan a Simple Program

Choose a simple everyday task (for example, a shopping list checker, a grade calculator, or a simple quiz). Write a plan that explains:

  1. What the program does
  2. The steps it follows (algorithm)
  3. The decisions it makes (if / else)
  4. The tasks it repeats (loops)
  5. The information it stores (variables and lists)

Draw a flowchart of your program. Present your plan to a friend, teacher, or family member. This plan becomes your portfolio piece.


๐Ÿ’ก Why Take This Course?

  • It is short and easy to follow.
  • No coding experience needed.
  • You will think more clearly and solve problems better.
  • It prepares you for HTML, CSS, JavaScript, and other programming languages.

โœ… By the End of This Course

  • You will know what programming logic is.
  • You will be able to break problems into steps.
  • You will understand decisions and loops.
  • You will know how programs store information.
  • You will have a written plan and flowchart for a simple program.

โžก๏ธ What Comes Next?

After this course, you can continue to Introduction to Web Development, where you will use this logic to build real web pages with HTML, CSS, and JavaScript.


Programming Logic for Web Developers ยท Course Outline

Beginner Friendly ยท 2026

2

Module One

Module 1 ยท Thinking in Steps

โฌ… Back to Course Outline

๐Ÿง  Module 1 โ€” Thinking in Steps

Programming Logic for Web Developers ยท Beginner Level ยท 2026


1. Module Introduction

Welcome to the very first module of Programming Logic for Web Developers. This is the start of an exciting journey. By the end, you will understand how programmers think. You will learn the secret behind every program, every app, and every website.

Have you ever followed a recipe to cook rice? Have you ever given directions to a stranger? Have you ever solved a maths problem step by step? If yes, then you already use logic. Logic is the art of thinking in clear, ordered steps.

Programming logic is simply using logic to tell a computer what to do. Computers are fast, but they are not clever. They cannot guess. They need clear steps. When you learn to give clear steps, you can control a computer.

In this module, you will learn what programming logic is. You will learn how to break a big problem into small steps. You will learn about algorithms, flowcharts, and pseudocode. Do not worry if these words sound strange. Every word will be explained in very simple language.

This module is written for beginners. You do not need to know any coding. You do not need a computer. You just need a curious mind. So grab a notebook, sit comfortably, and let us begin.

    YOUR LEARNING JOURNEY IN MODULE 1
    =================================

    [ Start ]
        |
        V
    What is Programming Logic?
        |
        V
    Thinking in Steps
        |
        V
    Algorithms
        |
        V
    Flowcharts
        |
        V
    Pseudocode
        |
        V
    Breaking Problems into Small Steps
        |
        V
    [ You can now think like a programmer! ]
    

Summary of the Introduction

This module introduces programming logic. You will learn how to think in clear steps. You will learn about algorithms, flowcharts, and pseudocode. Everything is explained in simple language with plenty of examples.


2. Learning Objectives

By the end of this module, you will be able to:

  1. Explain what programming logic means in your own words.
  2. Describe why computers need clear, ordered steps.
  3. Explain what an algorithm is and give examples.
  4. Draw a simple flowchart using basic symbols.
  5. Write simple pseudocode for a daily task.
  6. Break a big problem into small, easy steps.
  7. Spot the correct order of steps in a task.
  8. Identify mistakes when steps are out of order.
  9. Give examples of algorithms from real life, school, home, and Nigeria.
  10. Feel confident and curious to continue to Module 2.

Summary of Learning Objectives

You will learn what programming logic is, how to think in steps, how to write algorithms, how to draw flowcharts, and how to write pseudocode.


3. Warm-up Story โ€” Tunde and the Robot Helper

Tunde is a 12-year-old boy who lives in Ibadan. For his birthday, his uncle sent him a small robot. The robot was called RB-1. It could walk, talk, and do simple tasks.

Tunde was very excited. "RB-1, please bring me a cup of water," he said.

The robot stood still. It did not move.

"RB-1, bring me water!" Tunde said again, louder this time.

The robot blinked its lights. "I do not understand. Please give clear steps."

Tunde's mother laughed. "Tunde, the robot cannot guess. You must tell it exactly what to do, step by step."

So Tunde thought carefully. Then he said:

  1. Walk to the kitchen.
  2. Find the cupboard.
  3. Open the cupboard.
  4. Take a clean cup.
  5. Walk to the tap.
  6. Turn on the tap.
  7. Fill the cup with water.
  8. Turn off the tap.
  9. Walk back to me.
  10. Hand me the cup.

The robot followed each step. It walked to the kitchen. It opened the cupboard. It took a cup. It filled it with water. It walked back. It handed Tunde the cup.

"You did it!" Tunde shouted.

"Thank you," said RB-1. "Next time, remember: clear steps make everything possible."

Tunde learned a big lesson that day. Computers and robots are not clever on their own. They need clear, ordered steps. That is what programming logic is all about.

    TUNDE AND THE ROBOT
    ===================

    [ Tunde says: "Bring water" ]
              |
              V
    [ Robot does not understand ]
              |
              V
    [ Tunde gives clear steps ]
              |
              V
    [ Robot follows each step ]
              |
              V
    [ Tunde gets his water! ]
    

Summary of the Warm-up Story

Tunde learned that robots and computers need clear, ordered steps. Without clear steps, they cannot do anything. This story introduces the whole module.


4. Main Lessons

In this section, you will go through 12 short lessons. Each lesson teaches one big idea. Each lesson ends with a mini summary. Read slowly. Think about the examples. Ask questions. That is how you learn.

Lesson 1 โ€” What is Programming Logic?

Definition

Programming logic is the skill of thinking in clear, ordered steps that a computer can follow. It is the way programmers plan what a program should do before they write any code.

Why it is important

Without logic, a program would be a mess. Computers need clear instructions. If the steps are wrong, the program fails.

Simple explanation

Think of giving directions to a stranger. If you say, "Go somewhere near the market," the stranger will get lost. If you say, "Walk straight for 200 metres, turn left at the bank, then walk 50 metres," the stranger will find the place. Programming logic is like that.

Real-life example

When you use an ATM, the machine follows clear steps: insert card, enter PIN, choose amount, take cash. That is programming logic in action.

School example

When your teacher gives you steps to solve a maths problem, that is a kind of logic. You follow each step in order.

Home example

When your mother gives you steps to cook rice, that is logic. Wash the rice. Boil water. Add rice. Cook for 20 minutes.

Nigerian example

When you buy airtime at a kiosk, the seller follows steps: check your network, collect money, dial the code, and confirm. That is logic.

Illustration

    PROGRAMMING LOGIC
    =================

    [ Clear step 1 ]
          |
          V
    [ Clear step 2 ]
          |
          V
    [ Clear step 3 ]
          |
          V
    [ Task complete! ]
        

Mini summary

Programming logic is thinking in clear, ordered steps. It is the way programmers plan before writing code.


Lesson 2 โ€” Why Computers Need Clear Steps

Definition

A computer cannot think or guess. It can only follow instructions. If the instructions are unclear, the computer will fail or do the wrong thing.

Why it is important

Understanding this helps you write better instructions. It also helps you see why clear logic matters.

Simple explanation

Think of a very obedient but very dumb helper. If you say, "Bring me a cup," the helper might bring a broken cup. If you say, "Bring me a clean, empty cup," the helper will bring the right thing. A computer is like that helper.

Real-life example

If you type a wrong password in a web application, it will not open. The computer only checks what you typed. It cannot guess that you meant something else.

School example

If a teacher says, "Write an essay," students might be confused. If she says, "Write an essay of 200 words about your school," students know what to do. A computer is like that.

Home example

If you tell your younger brother, "Go and buy something," he may buy the wrong thing. If you say, "Buy two loaves of bread from Mama Nkechi's shop," he will get it right.

Nigerian example

If you dial the wrong USSD code, you will not buy airtime. The computer checks only what you typed.

Illustration

    CLEAR vs UNCLEAR STEPS
    ======================

    Unclear:  "Bring me a cup"
              |
              V
    Computer: ???? (confused)

    Clear:    "Walk to the kitchen.
               Open the cupboard.
               Take a clean cup."
              |
              V
    Computer: Does it perfectly!
        

Mini summary

Computers cannot guess. They need clear, exact steps. Unclear steps lead to failure.


Lesson 3 โ€” Thinking in Steps

Definition

Thinking in steps means breaking a task into small, simple actions that happen one after another.

Why it is important

Big tasks are hard. Small steps are easy. When you break a task into steps, you can solve it without confusion.

Simple explanation

Think of climbing a staircase. You do not jump to the top. You climb one step at a time. Programming works the same way.

Real-life example

Brushing your teeth has steps: pick up toothbrush, put toothpaste, add water, brush, rinse, spit, clean brush, put it away.

School example

Solving a maths problem has steps: read the question, write what is given, choose the formula, solve, check the answer.

Home example

Washing plates has steps: clear leftover food, add soap, scrub, rinse, dry, put away.

Nigerian example

Preparing garri has steps: boil water, pour garri into a bowl, add water, stir, add sugar and milk, serve.

Illustration

    THINKING IN STEPS
    =================

    Big task: "Make tea"

    Steps:
      1. Boil water
      2. Put tea bag in cup
      3. Pour hot water
      4. Add sugar and milk
      5. Stir
      6. Serve
        

Mini summary

Thinking in steps means breaking a task into small, simple actions. It makes big tasks easy.


Lesson 4 โ€” The Right Order Matters

Definition

Order means the sequence in which steps happen. In programming, the order matters. Wrong order causes wrong results.

Why it is important

If you put on your shoes before your socks, it will look strange. If you put water in a cup before taking it from the cupboard, you cannot. Order matters.

Simple explanation

Think of a phone number. If you change the order of the digits, you call a different person. Order matters in programming too.

Real-life example

You cannot enter your PIN before inserting your ATM card. The order is fixed.

School example

You cannot write the answer before reading the question. You must read first.

Home example

You cannot eat before cooking. The order is: cook, then eat.

Nigerian example

You cannot pour petrol into a car before opening the fuel tank. Order matters.

Illustration

    WRONG ORDER vs RIGHT ORDER
    ==========================

    Wrong order:
      [ Put on shoes ]
              |
              V
      [ Put on socks ]
              |
              V
      Looks strange!

    Right order:
      [ Put on socks ]
              |
              V
      [ Put on shoes ]
              |
              V
      Looks perfect!
        

Mini summary

Order matters. Steps must happen in the right sequence. Wrong order causes wrong results.


Lesson 5 โ€” What is an Algorithm?

Definition

An algorithm is a set of clear, ordered steps to solve a problem or complete a task.

Why it is important

Algorithms are the heart of programming. Every program uses algorithms. Without an algorithm, a program has no plan.

Simple explanation

Think of a recipe. A recipe has steps. It tells you what to do first, second, and third. An algorithm is a recipe for a computer.

Real-life example

A recipe for jollof rice is an algorithm. It has clear steps.

School example

Steps to solve a long division problem form an algorithm.

Home example

Steps to wash your hands form an algorithm: wet, soap, scrub, rinse, dry.

Nigerian example

Steps to buy airtime: dial code, enter amount, enter PIN, receive confirmation. That is an algorithm.

Illustration

    ALGORITHM EXAMPLE
    =================

    Task: Brush your teeth

    Algorithm:
      1. Pick up toothbrush
      2. Put toothpaste on it
      3. Add water
      4. Brush for 2 minutes
      5. Rinse mouth
      6. Clean toothbrush
      7. Put toothbrush away
        

Mini summary

An algorithm is a set of clear, ordered steps to solve a problem. Every program uses algorithms.


Lesson 6 โ€” Algorithms in Everyday Life

Definition

Algorithms are not just for computers. They are everywhere in daily life. Any task with clear steps is an algorithm.

Why it is important

Recognizing algorithms in daily life helps you see the world like a programmer.

Simple explanation

Think of getting ready for school. You follow steps: wake up, brush teeth, take a bath, dress up, eat breakfast, pack your bag, leave. That is an algorithm.

Real-life example

Withdrawing money from an ATM is an algorithm: insert card, enter PIN, choose amount, collect cash, collect card.

School example

Registering for exams is an algorithm: fill form, pay fees, submit, collect receipt, get exam number.

Home example

Washing clothes by hand is an algorithm: sort clothes, add soap, scrub, rinse, wring, hang to dry.

Nigerian example

Making puff-puff is an algorithm: mix flour and sugar, add yeast, add water, stir, let it rise, scoop into oil, fry, remove, drain.

Illustration

    ALGORITHMS EVERYWHERE
    =====================

    [ Making tea ]
    [ Getting ready for school ]
    [ Buying airtime ]
    [ Cooking jollof rice ]
    [ Charging a phone ]
    [ Sending a text message ]

    All of these have clear steps = algorithms!
        

Mini summary

Algorithms are everywhere. Any task with clear steps is an algorithm. You already use them every day.


Lesson 7 โ€” What is a Flowchart?

Definition

A flowchart is a picture that shows the steps of an algorithm. It uses shapes and arrows to show what happens and in what order.

Why it is important

Flowcharts make steps easy to see. They help you find mistakes. They also help you explain your plan to others.

Simple explanation

Think of a treasure map. It shows paths and directions. A flowchart is like a map of steps.

Common Flowchart Symbols

  • Oval โ€” Start or End
  • Rectangle โ€” A step or action
  • Diamond โ€” A question or decision
  • Arrow โ€” Shows the direction

Real-life example

A flowchart for withdrawing money shows: Start, insert card, enter PIN, correct PIN? Yes or No, collect cash, End.

School example

A flowchart for passing an exam shows: Start, study, write exam, score above pass mark? Yes or No, Pass or Fail, End.

Home example

A flowchart for cooking rice shows: Start, wash rice, boil water, add rice, cook, is it soft? Yes or No, serve, End.

Nigerian example

A flowchart for buying fuel shows: Start, drive to station, is there fuel? Yes or No, buy fuel, End.

Illustration

    FLOWCHART SYMBOLS
    =================

    ( Start )         <- Oval

         |
         V
    [ Step 1 ]        <- Rectangle

         |
         V
    < Decision? >     <- Diamond
      /       \
    Yes        No
     |          |
     V          V
    [ Step 2 ] [ Step 3 ]

         |
         V
    ( End )           <- Oval
        

Mini summary

A flowchart is a picture of an algorithm. It uses shapes and arrows to show steps clearly.


Lesson 8 โ€” Drawing Simple Flowcharts

Definition

Drawing a flowchart means using shapes and arrows to show the steps of an algorithm.

Why it is important

Drawing helps you think clearly. It also helps you explain your plan to others.

Simple explanation

Think of drawing a map to your house. You use lines and arrows. A flowchart is the same, but for steps.

Steps to Draw a Flowchart

  1. Start with an oval. Write "Start".
  2. Add a rectangle for the first step.
  3. Draw an arrow to the next step.
  4. If there is a decision, use a diamond.
  5. Draw arrows for Yes and No.
  6. End with an oval. Write "End".

Real-life example

A flowchart for making tea: Start, boil water, put tea bag in cup, pour water, add sugar, stir, serve, End.

School example

A flowchart for submitting homework: Start, open book, do homework, check answers, submit, End.

Home example

A flowchart for charging a phone: Start, find charger, plug charger, connect phone, wait, phone charged? Yes or No, unplug, End.

Nigerian example

A flowchart for sending money: Start, open bank app, enter account number, enter amount, confirm, money sent? Yes or No, End.

Illustration

    FLOWCHART: MAKING TEA
    =====================

    ( Start )
        |
        V
    [ Boil water ]
        |
        V
    [ Put tea bag in cup ]
        |
        V
    [ Pour hot water ]
        |
        V
    [ Add sugar and milk ]
        |
        V
    [ Stir ]
        |
        V
    [ Serve ]
        |
        V
    ( End )
        

Mini summary

Drawing a flowchart means using shapes and arrows to show steps. Start with an oval, add rectangles, and end with an oval.


Lesson 9 โ€” What is Pseudocode?

Definition

Pseudocode means "fake code." It is a way of writing steps in plain English, using simple words. It is not real code, but it looks like it.

Why it is important

Pseudocode helps you plan before writing real code. It is easy to change. It helps you think clearly.

Simple explanation

Think of a script for a play. It tells actors what to say and do. Pseudocode is a script for your program.

Example of Pseudocode

    START
      Boil water
      Put tea bag in cup
      Pour water into cup
      Add sugar
      Add milk
      Stir
      Serve tea
    END
        

Real-life example

Pseudocode for withdrawing money: START, insert card, enter PIN, if PIN is correct, enter amount, if enough money, give cash, END.

School example

Pseudocode for checking exam results: START, enter exam number, if number is valid, show results, else show error, END.

Home example

Pseudocode for charging a phone: START, find charger, plug charger, connect phone, if phone is charged, unplug, END.

Nigerian example

Pseudocode for buying airtime: START, dial code, enter amount, enter PIN, if PIN is correct, buy airtime, END.

Illustration

    PSEUDOCODE EXAMPLE
    ==================

    START
      Wake up
      Brush teeth
      Take a bath
      Dress up
      Eat breakfast
      Pack bag
      If it is raining:
        Take umbrella
      Leave for school
    END
        

Mini summary

Pseudocode is fake code. It uses plain English to plan steps before writing real code.


Lesson 10 โ€” Breaking Big Problems into Small Steps

Definition

Breaking a big problem into small steps means splitting a hard task into smaller, easier tasks.

Why it is important

Big problems are scary. Small steps are easy. When you break a problem down, you can solve it without confusion.

Simple explanation

Think of eating a whole goat. You cannot eat it in one bite. You cut it into pieces. Programming works the same way.

Real-life example

Planning a wedding is a big problem. Breaking it down: choose a date, book a hall, send invitations, order food, arrange music, etc.

School example

Writing a long essay: choose a topic, make an outline, write the introduction, write the body, write the conclusion, edit, submit.

Home example

Cleaning the house: clean the bedroom, clean the living room, clean the kitchen, clean the bathroom, sweep the compound.

Nigerian example

Planning a trip from Lagos to Abuja: choose a date, buy a ticket, pack bags, go to the park, board the bus, travel, arrive.

Illustration

    BREAKING A BIG PROBLEM
    ======================

    Big problem: "Plan a birthday party"

    Break it down:
      -> Choose a date
      -> Choose a place
      -> Make a guest list
      -> Buy food and drinks
      -> Plan games
      -> Send invitations
      -> Set up
      -> Celebrate! ๐ŸŽ‰
        

Mini summary

Breaking a big problem into small steps makes it easier to solve. This is a key skill in programming.


Lesson 11 โ€” Finding Mistakes in Steps

Definition

Finding mistakes in steps means checking the order and content of each step to see if something is wrong.

Why it is important

Mistakes in steps cause programs to fail. Finding mistakes early saves time and prevents bigger problems.

Simple explanation

Think of a road trip. If you take the wrong turn, you will not reach your destination. Checking the map helps you find and fix the mistake. Programming is the same.

Common Mistakes in Steps

  • Missing steps
  • Wrong order
  • Unclear instructions
  • Repeated steps
  • Unnecessary steps

Real-life example

If a recipe says "bake the cake before mixing the flour," that is a mistake in order.

School example

If a maths solution says "write the answer before solving," that is a mistake.

Home example

If instructions say "put the pot on the fire before adding water," you might burn the pot. That is a mistake.

Nigerian example

If the steps for buying airtime say "enter PIN before dialing the code," it will fail. That is a mistake.

Illustration

    FINDING MISTAKES
    ================

    Steps for making tea:
      1. Boil water
      2. Put tea bag in cup
      3. Pour hot water
      4. Add sugar and milk
      5. Drink
      6. Stir  <-- MISTAKE! This should come before drinking.

    Fix: Move "Stir" to step 5.
        

Mini summary

Finding mistakes in steps means checking the order and content. Mistakes cause programs to fail.


Lesson 12 โ€” Thinking Like a Programmer

Definition

Thinking like a programmer means seeing tasks as steps, finding patterns, and planning before doing.

Why it is important

This skill helps you solve problems in school, at home, and in any job. It is useful for life, not just for coding.

Simple explanation

Think of a detective. A detective notices details, asks questions, and follows clues. A programmer does the same with tasks.

How to Think Like a Programmer

  1. Understand the problem.
  2. Break it into small steps.
  3. Put the steps in order.
  4. Check for mistakes.
  5. Test the steps.
  6. Improve the steps.

Real-life example

Planning a trip becomes easy when you think in steps: destination, date, cost, transport, packing, travel.

School example

Solving a hard maths problem becomes easier when you break it down.

Home example

Cooking a big meal becomes easier when you plan the steps in order.

Nigerian example

Starting a small business becomes easier when you plan the steps: idea, money, location, suppliers, customers, marketing.

Illustration

    THINKING LIKE A PROGRAMMER
    ==========================

    [ Understand the problem ]
              |
              V
    [ Break into small steps ]
              |
              V
    [ Put in order ]
              |
              V
    [ Check for mistakes ]
              |
              V
    [ Test the steps ]
              |
              V
    [ Improve ]
              |
              V
    [ Solve the problem! ]
        

Mini summary

Thinking like a programmer means breaking problems into steps, finding patterns, and planning before doing.

Summary of Main Lessons

You have now learned the core ideas of Module 1: what programming logic is, why computers need clear steps, how to think in steps, why order matters, what algorithms are, how to draw flowcharts, how to write pseudocode, how to break big problems into small steps, how to find mistakes, and how to think like a programmer.


5. Key Vocabulary

Word Simple Definition
Programming logic Thinking in clear, ordered steps a computer can follow.
Step One small action in a task.
Order The sequence in which steps happen.
Algorithm A set of clear, ordered steps to solve a problem.
Flowchart A picture showing the steps of an algorithm.
Pseudocode Fake code that uses plain English.
Start Where a program or task begins.
End Where a program or task finishes.
Decision A point where you choose between options.
Step-by-step Doing things one step at a time.
Sequence The order in which things happen.
Instruction A command telling the computer what to do.
Mistake Something wrong in the steps.
Plan Deciding what to do before doing it.
Problem-solving Finding a way to fix or complete something.

Summary of Key Vocabulary

These words will help you understand programming logic. Use them often so they become easy.


6. Important Concepts

Concept 1 โ€” Computers Need Clear Steps

Computers cannot guess. They need clear, ordered steps.

Concept 2 โ€” Order Matters

Steps must happen in the right order. Wrong order causes wrong results.

Concept 3 โ€” Algorithms Are Everywhere

Any task with clear steps is an algorithm. You use them every day.

Concept 4 โ€” Plan Before You Build

Flowcharts and pseudocode help you plan before writing real code.

Concept 5 โ€” Break Big Problems into Small Steps

Big problems are easy to solve when broken into small steps.

Summary of Important Concepts

These five concepts are the heart of Module 1. Read them again before moving on.


7. Step-by-step Explanations

Step-by-step: How to Write an Algorithm

  1. Understand the task. What do you want to do?
  2. List the steps. Write every action.
  3. Put them in order. Make sure the order is correct.
  4. Check for mistakes. Are any steps missing?
  5. Simplify. Remove unnecessary steps.
  6. Test. Follow the steps yourself.
  7. Improve. Fix any problems.
    WRITING AN ALGORITHM
    ====================

    [ Understand task ]
          |
          V
    [ List steps ]
          |
          V
    [ Put in order ]
          |
          V
    [ Check for mistakes ]
          |
          V
    [ Simplify ]
          |
          V
    [ Test ]
          |
          V
    [ Improve ]
    

Step-by-step: How to Draw a Flowchart

  1. Start with an oval. Write "Start".
  2. Add a rectangle for the first step.
  3. Draw an arrow to the next step.
  4. Use a diamond if there is a decision.
  5. Label arrows "Yes" and "No".
  6. Continue with rectangles for more steps.
  7. End with an oval. Write "End".
    DRAWING A FLOWCHART
    ===================

    ( Start )
        |
        V
    [ Step 1 ]
        |
        V
    < Decision? >
      /       \
    Yes        No
     |          |
     V          V
    [ Step 2 ] [ Step 3 ]
        |
        V
    ( End )
    

Summary of Step-by-step Explanations

Writing an algorithm and drawing a flowchart both follow clear steps. Following steps makes it easy.


8. Real-life Examples

Example 1 โ€” Using an ATM

Steps: insert card, enter PIN, choose amount, collect cash, collect card.

Example 2 โ€” Ordering Food Online

Steps: open app, choose restaurant, choose food, add to cart, pay, wait for delivery.

Example 3 โ€” Booking a Flight

Steps: choose destination, choose date, choose airline, enter passenger details, pay, receive ticket.

Example 4 โ€” Registering for School

Steps: fill form, submit documents, pay fees, receive admission letter.

Example 5 โ€” Sending a Package

Steps: pack item, write address, pay postage, send, receive confirmation.

Summary of Real-life Examples

Algorithms are in ATMs, online shopping, flight booking, school registration, and package delivery.


9. Nigerian Examples

Example 1 โ€” Buying Airtime

Steps: dial code, enter amount, enter PIN, receive confirmation.

Example 2 โ€” Sending Money

Steps: open bank app, enter account number, enter amount, confirm, receive receipt.

Example 3 โ€” Cooking Jollof Rice

Steps: blend pepper and tomatoes, fry, add stock, add rice, cook, serve.

Example 4 โ€” Buying Fuel

Steps: drive to station, queue, pay, fill tank, pay again if needed, drive off.

Example 5 โ€” Sending a Parcel

Steps: pack item, write address, go to park, pay driver, hand over parcel, call receiver.

Summary of Nigerian Examples

Nigeria has many examples of algorithms: buying airtime, sending money, cooking, buying fuel, and sending parcels.


10. Fun Examples Children Can Relate To

Example 1 โ€” Playing a Video Game

Steps: start game, choose character, choose level, play, win or lose, restart or exit.

Example 2 โ€” Making a Sandwich

Steps: take bread, add butter, add filling, close, cut, eat.

Example 3 โ€” Flying a Kite

Steps: find open space, hold string, run, release kite, let it fly, pull gently.

Example 4 โ€” Making a Paper Plane

Steps: take paper, fold in half, fold corners, fold again, fold wings, throw.

Example 5 โ€” Building a Sandcastle

Steps: find sand, add water, fill bucket, turn over, pat, decorate.

Summary of Fun Examples

Algorithms are in video games, sandwich making, kite flying, paper planes, and sandcastles.


11. Everyday Examples

Task First Step Last Step
Brushing teeth Pick up toothbrush Put toothbrush away
Charging phone Find charger Unplug when charged
Cooking rice Wash rice Serve
Going to school Wake up Arrive at school
Sending a text Open messaging app Send message

Summary of Everyday Examples

Even simple daily activities are algorithms. Now you can see them everywhere.


12. Parent Tips

  1. Ask your child to explain steps. When they do a task, ask them to describe each step.
  2. Point out algorithms in daily life. Cooking, dressing, and cleaning are all algorithms.
  3. Draw flowcharts together. Use paper and pencil. Draw simple steps.
  4. Practice pseudocode. Ask your child to write steps in plain English.
  5. Play step games. Ask your child to give you steps to follow. Then follow them literally.
  6. Praise clear thinking. When your child breaks a task into steps, praise them.
  7. Encourage curiosity. When they ask how something works, help them break it down.
  8. Be patient. Logical thinking takes practice. Encourage, do not pressure.

Summary of Parent Tips

Parents can help children develop logical thinking through daily activities and simple games.


13. Interesting Facts

  1. The word "algorithm" comes from the name of a Persian mathematician, Al-Khwarizmi.
  2. The first computer programs were written as step-by-step instructions on paper.
  3. Flowcharts were invented in the 1920s, long before computers were common.
  4. Pseudocode is used by professional programmers every day.
  5. Algorithms can be very short or very long. Some have millions of steps.
  6. The same task can have many different algorithms. Some are faster than others.
  7. Many Nigerian tech companies start their projects by planning with flowcharts.
  8. Even simple games like tic-tac-toe use algorithms.

Summary of Interesting Facts

Algorithms and flowcharts are old, powerful, and used everywhere.


14. Did You Know?

  • Did you know that you use algorithms every day without knowing it?
  • Did you know that the same algorithm can be written in many different programming languages?
  • Did you know that programmers often plan on paper before typing any code?
  • Did you know that flowcharts help teams understand a plan quickly?
  • Did you know that pseudocode is not real code, but it looks like code?
  • Did you know that many successful businesses start with a simple algorithm?

Summary of Did You Know?

Algorithms, flowcharts, and pseudocode are used by people all over the world every day.


15. Remember This

  • Programming logic is thinking in clear, ordered steps.
  • Computers cannot guess. They need clear steps.
  • Order matters. Wrong order causes wrong results.
  • An algorithm is a set of clear, ordered steps.
  • Algorithms are everywhere in daily life.
  • A flowchart is a picture of an algorithm.
  • Pseudocode is fake code written in plain English.
  • Break big problems into small steps.
  • Find mistakes in steps before they cause problems.
  • Thinking like a programmer helps in school, home, and life.

Summary of Remember This

These ten points are the heart of Module 1. Read them again before moving on.


16. Common Mistakes

  1. Thinking computers can guess. They cannot. They need clear steps.
  2. Leaving out steps. Missing steps cause confusion.
  3. Putting steps in the wrong order. Wrong order causes wrong results.
  4. Writing unclear instructions. The computer will not understand.
  5. Trying to solve big problems at once. Break them into small steps.
  6. Skipping planning. Planning saves time and mistakes.
  7. Ignoring flowcharts and pseudocode. They help you think clearly.
  8. Giving up too soon. Logical thinking takes practice.

Summary of Common Mistakes

Avoiding these mistakes will make you a better logical thinker than many adults.


17. Best Practices

  1. Always understand the task before starting.
  2. Break tasks into small steps.
  3. Put steps in the correct order.
  4. Write steps clearly and simply.
  5. Draw flowcharts for tasks with decisions.
  6. Write pseudocode before real code.
  7. Check for mistakes.
  8. Test your steps.
  9. Improve your plan after testing.
  10. Practice logical thinking every day.

Summary of Best Practices

These ten practices will help you become a strong logical thinker.


18. ASCII Illustrations, Diagrams, Flowcharts, and Timelines

Diagram 1 โ€” Programming Logic

    PROGRAMMING LOGIC
    =================

    [ Clear step 1 ]
          |
          V
    [ Clear step 2 ]
          |
          V
    [ Clear step 3 ]
          |
          V
    [ Task complete! ]
    

Diagram 2 โ€” Clear vs Unclear Steps

    CLEAR vs UNCLEAR STEPS
    ======================

    Unclear:  "Bring me a cup"
              |
              V
    Computer: ???? (confused)

    Clear:    "Walk to the kitchen.
               Open the cupboard.
               Take a clean cup."
              |
              V
    Computer: Does it perfectly!
    

Diagram 3 โ€” Thinking in Steps

    THINKING IN STEPS
    =================

    Big task: "Make tea"

    Steps:
      1. Boil water
      2. Put tea bag in cup
      3. Pour hot water
      4. Add sugar and milk
      5. Stir
      6. Serve
    

Diagram 4 โ€” Flowchart Symbols

    FLOWCHART SYMBOLS
    =================

    ( Start )         <- Oval

         |
         V
    [ Step 1 ]        <- Rectangle

         |
         V
    < Decision? >     <- Diamond
      /       \
    Yes        No
     |          |
     V          V
    [ Step 2 ] [ Step 3 ]

         |
         V
    ( End )           <- Oval
    

Diagram 5 โ€” Breaking a Big Problem

    BREAKING A BIG PROBLEM
    ======================

    Big problem: "Plan a birthday party"

    Break it down:
      -> Choose a date
      -> Choose a place
      -> Make a guest list
      -> Buy food and drinks
      -> Plan games
      -> Send invitations
      -> Set up
      -> Celebrate! ๐ŸŽ‰
    

Diagram 6 โ€” Thinking Like a Programmer

    THINKING LIKE A PROGRAMMER
    ==========================

    [ Understand the problem ]
              |
              V
    [ Break into small steps ]
              |
              V
    [ Put in order ]
              |
              V
    [ Check for mistakes ]
              |
              V
    [ Test the steps ]
              |
              V
    [ Improve ]
              |
              V
    [ Solve the problem! ]
    

Summary of Illustrations

These diagrams help you see programming logic clearly. Draw them yourself to remember them better.


19. Comparison Tables

Table 1 โ€” Algorithm vs Flowchart vs Pseudocode

Algorithm Flowchart Pseudocode
Steps written in words Steps shown in shapes Steps written as fake code
Easy to write Easy to see Easy to change
Good for planning Good for explaining Good for coding

Table 2 โ€” Clear vs Unclear Steps

Clear Steps Unclear Steps
Exact and simple Vague and confusing
In the correct order Wrong order
Complete Missing steps
Computer understands Computer fails

Table 3 โ€” Real-life Tasks and Their Type

Task Has Decisions? Has Repetitions?
Making tea No No
Brushing teeth No Yes (brush each tooth)
Withdrawing money Yes (correct PIN?) No
Charging phone Yes (charged yet?) Yes (wait)

Summary of Comparison Tables

Comparing ideas side by side helps you remember the differences clearly.


20. Summary After Every Lesson (Consolidated)

Lesson Main Idea
Lesson 1 Programming logic means thinking in clear, ordered steps.
Lesson 2 Computers cannot guess. They need clear steps.
Lesson 3 Thinking in steps means breaking tasks into small actions.
Lesson 4 Order matters. Wrong order causes wrong results.
Lesson 5 An algorithm is a set of clear, ordered steps.
Lesson 6 Algorithms are everywhere in daily life.
Lesson 7 A flowchart is a picture of an algorithm.
Lesson 8 Drawing flowcharts uses shapes and arrows.
Lesson 9 Pseudocode is fake code written in plain English.
Lesson 10 Break big problems into small steps.
Lesson 11 Finding mistakes in steps prevents bigger problems.
Lesson 12 Thinking like a programmer helps in life, not just coding.

21. End-of-Module Summary

Congratulations! You have completed Module 1. Let us review what you have learned.

You began by learning that programming logic is the skill of thinking in clear, ordered steps that a computer can follow.

You learned that computers cannot guess. They need clear steps. If the steps are unclear, the program fails.

You discovered how to think in steps. Big tasks become easy when broken into small actions.

You learned that order matters. Steps must happen in the right sequence.

You explored algorithms โ€” sets of clear, ordered steps to solve a problem. You saw that algorithms are everywhere in daily life.

You discovered flowcharts โ€” pictures that show the steps of an algorithm using shapes and arrows.

You learned about pseudocode โ€” fake code written in plain English to plan steps before writing real code.

You practiced breaking big problems into small steps. This makes hard tasks easy.

You learned how to find mistakes in steps and fix them.

Finally, you learned how to think like a programmer. This skill helps you in school, home, and any job.

    MODULE 1 SUMMARY MAP
    ====================

    [ Programming Logic ]
              |
              V
    [ Thinking in Steps ] --> [ Order Matters ]
              |
              V
    [ Algorithms ] --> [ Flowcharts ] --> [ Pseudocode ]
              |
              V
    [ Breaking Problems ] --> [ Finding Mistakes ]
              |
              V
    [ Thinking Like a Programmer! ]
    

Well done! You now have a strong foundation. In Module 2, you will learn how programs make decisions and repeat tasks.


22. Frequently Asked Questions (10 Questions)

Question 1: What is programming logic in the simplest words?

Programming logic is thinking in clear, ordered steps that a computer can follow.

Question 2: Do I need to know coding to learn programming logic?

No. You can learn programming logic with just pen and paper.

Question 3: Why do computers need clear steps?

Because computers cannot guess. They only follow the instructions you give them.

Question 4: What is an algorithm?

An algorithm is a set of clear, ordered steps to solve a problem or complete a task.

Question 5: What is a flowchart?

A flowchart is a picture that shows the steps of an algorithm using shapes and arrows.

Question 6: What is pseudocode?

Pseudocode is fake code that uses plain English to describe steps.

Question 7: What is the difference between an algorithm and pseudocode?

An algorithm can be written in any form. Pseudocode is one way of writing an algorithm using simple, code-like words.

Question 8: Why does order matter in steps?

Because steps must happen in the right sequence. Wrong order causes wrong results.

Question 9: Can I use programming logic in daily life?

Yes! You already use it for cooking, dressing, doing homework, and many other tasks.

Question 10: What will I learn in Module 2?

You will learn how programs make decisions (if / else) and how they repeat tasks (loops).


23. Matching Exercises

Exercise 1 โ€” Match the Word to the Meaning

Column A (Word) Column B (Meaning)
1. Algorithm A. A picture showing steps
2. Flowchart B. A set of clear, ordered steps
3. Pseudocode C. The order in which steps happen
4. Order D. Fake code in plain English
5. Logic E. Thinking in clear, ordered steps

Answers: 1-B, 2-A, 3-D, 4-C, 5-E

Exercise 2 โ€” Match the Task to Its Type

Column A (Task) Column B (Type)
1. Making tea A. Has a decision
2. Withdrawing money B. Simple sequence
3. Charging a phone C. Has repetition
4. Brushing teeth D. Has both decision and repetition

Answers: 1-B, 2-A, 3-D, 4-C

Summary of Matching Exercises

Matching helps you connect words to meanings quickly.


24. Scenario-based Exercises

Scenario 1 โ€” The Confused Robot

A girl tells her robot, "Bring me a book." The robot does not move.

Questions:

  1. Why did the robot not move?
  2. What should the girl do instead?
  3. Write three clear steps she could give.

Scenario 2 โ€” The Wrong Recipe

A boy wants to make tea. His steps are: pour water into cup, boil water, add tea bag, drink. The tea is cold and tasteless.

Questions:

  1. What mistake did he make?
  2. What is the correct order?
  3. Why does order matter?

Scenario 3 โ€” The Missing Step

A student writes steps for buying airtime: dial code, enter amount, receive confirmation. But the airtime is not added.

Questions:

  1. What step is missing?
  2. Why is this step important?
  3. How can the student fix the algorithm?

Summary of Scenario-based Exercises

These scenarios help you apply what you have learned to real situations.


25. Group Activity

Activity: Write an Algorithm for a Daily Task

Group size: 3โ€“5 students

Time: 30 minutes

Materials: Paper, pencil

Instructions:

  1. Choose a daily task (e.g., making a sandwich, going to school).
  2. Write the steps as an algorithm.
  3. Draw a simple flowchart.
  4. Check the order and fix any mistakes.
  5. Present your algorithm to the class.

Goal: To practise writing algorithms and flowcharts as a team.


26. Individual Activity

Activity: My Morning Algorithm

Time: 20 minutes

Materials: Notebook, pencil

Instructions:

  1. Write the steps you follow every morning.
  2. Number each step in the correct order.
  3. Draw a simple flowchart of your morning routine.
  4. Check for any step you might have missed.

Goal: To connect algorithms to your own daily life.


27. Mini Project

Project: Design a Flowchart for a Simple Game

Time: 1โ€“2 hours

Materials: Paper, pencil, ruler

Instructions:

  1. Choose a simple game (e.g., guessing a number).
  2. Write an algorithm for the game.
  3. Draw a flowchart using shapes and arrows.
  4. Include at least one decision (Yes/No).
  5. Test your flowchart by following the steps.
  6. Present your project to the class.

Goal: To practise designing algorithms and flowcharts.


28. Practical Assignment

Assignment: Interview Someone About Their Daily Routine

Time: 1 week

Materials: Notebook, pencil

Instructions:

  1. Ask a family member or friend about a task they do often.
  2. Write down the steps as an algorithm.
  3. Draw a simple flowchart for the task.
  4. Check if any steps are missing or out of order.
  5. Write a one-page report on what you learned.

Goal: To see how algorithms appear in real life.


29. Key Takeaways

  1. Programming logic is thinking in clear, ordered steps.
  2. Computers cannot guess. They need clear steps.
  3. Order matters. Wrong order causes wrong results.
  4. An algorithm is a set of clear, ordered steps.
  5. Algorithms are everywhere in daily life.
  6. A flowchart is a picture of an algorithm.
  7. Pseudocode is fake code written in plain English.
  8. Break big problems into small steps.
  9. Find mistakes in steps before they cause problems.
  10. Thinking like a programmer helps in school, home, and life.

30. Classroom Discussion Questions

  1. Why do you think computers need clear steps?
  2. Can you give an example of an algorithm you use every day?
  3. Why does order matter in steps?
  4. What is the difference between an algorithm and pseudocode?
  5. Why do you think flowcharts are useful?
  6. What big problem would you like to break into small steps?
  7. What happens if you skip a step in an algorithm?
  8. Why is it important to find mistakes early?
  9. How can programming logic help you in school?
  10. What did you enjoy most in this module?

31. Preparation for the Next Module

You have finished Module 1. Well done! Here is how to prepare for Module 2, which is all about Making Decisions and Repeating Tasks.

  1. Review your key words. Make sure you can explain algorithm, flowchart, pseudocode, and order in your own words.
  2. Practise writing algorithms. Choose a daily task and write the steps.
  3. Draw flowcharts. Practice using ovals, rectangles, diamonds, and arrows.
  4. Look for decisions. Notice tasks where you must choose between options (like "if it rains, take an umbrella").
  5. Look for repetition. Notice tasks where you repeat steps (like brushing each tooth).
  6. Bring your curiosity. Module 2 will teach you about conditions, true and false, and loops.
    TRANSITION TO MODULE 2
    ======================

    [ Module 1: Thinking in Steps ]
              |
              V
    [ Module 2: Making Decisions and Repeating Tasks ]
              |
              V
    [ You will learn: if / else, true and false,
      comparisons, and loops ]
    

See you in Module 2. Keep thinking like a programmer!


3

Module Two

Module 2 ยท Making Decisions and Repeating Tasks

โฌ… Back to Course Outline

๐Ÿ”€ Module 2 โ€” Making Decisions and Repeating Tasks

Programming Logic for Web Developers ยท Beginner Level ยท 2026


1. Module Introduction

Welcome to Module 2. In Module 1, you learned how to think in steps. You learned what an algorithm is. You learned how to draw flowcharts and write pseudocode. Those are the foundations of programming logic.

Now we go one step further. Programs do not just follow steps in a straight line. They also make choices. They also repeat actions. Imagine a game that asks, "Do you want to play again?" If you say yes, it repeats. If you say no, it stops. That is a decision and a repetition.

In this module, you will learn how programs make decisions. You will learn about if, else, and else if. You will learn about true and false. You will also learn how programs repeat tasks using loops.

Do not worry if these words sound new. Every word will be explained in simple language. You will see examples from real life, from school, from home, and from Nigeria. You will also draw flowcharts and write pseudocode for decisions and loops.

This module is written for beginners. You do not need a computer. You just need your brain and a notebook. Let us begin.

    YOUR LEARNING JOURNEY IN MODULE 2
    =================================

    [ Start ]
        |
        V
    What is a Decision?
        |
        V
    True and False
        |
        V
    If Statements
        |
        V
    Else Statements
        |
        V
    What is a Loop?
        |
        V
    Repeat Loops
        |
        V
    While and For Loops
        |
        V
    [ You can now write programs that decide and repeat! ]
    

Summary of the Introduction

This module teaches you how programs make decisions and repeat tasks. You will learn about if, else, true and false, and loops. Everything is explained in simple language with examples.


2. Learning Objectives

By the end of this module, you will be able to:

  1. Explain what a decision is in a program.
  2. Describe what true and false mean.
  3. Use simple comparisons like equal, greater than, and less than.
  4. Write simple if statements in pseudocode.
  5. Add else and else if to handle more options.
  6. Draw a flowchart with a decision diamond.
  7. Explain what a loop is and why loops are useful.
  8. Write simple repeat loops in pseudocode.
  9. Understand while loops and for loops.
  10. Spot decisions and repetitions in daily life.

Summary of Learning Objectives

You will learn how to write decisions (if, else) and repetitions (loops). You will also learn true and false, comparisons, and how to draw flowcharts with decisions.


3. Warm-up Story โ€” Chidi and the Smart Gate

Chidi is a 12-year-old boy who lives in Abuja. One day, his school installed a new gate. It was a smart gate. It opened by itself.

Chidi was curious. He watched the gate carefully.

When a teacher walked close, the gate opened. When a student walked close, the gate opened. But when a stranger walked close, the gate stayed closed.

"How does it know?" Chidi asked the security guard.

"It uses a sensor," the guard said. "If the person has a school ID card, the gate opens. Else, the gate stays closed."

Chidi thought about it. "So it makes a decision?"

"Yes," the guard said. "It checks: Is there an ID card? If yes, open. If no, stay closed."

Chidi was amazed. He noticed something else. The gate did not open just once. It opened for every person who had an ID card. It repeated the decision again and again.

"It also repeats!" Chidi said.

"Exactly," the guard said. "It makes a decision, then repeats. That is how most programs work."

From that day, Chidi understood. Programs make decisions and repeat tasks. That is what this module is all about.

    CHIDI AND THE SMART GATE
    ========================

    [ Person walks close ]
              |
              V
    [ Gate checks: Does person have ID? ]
       /                          \
     Yes                          No
      |                            |
      V                            V
    [ Open gate ]              [ Stay closed ]

    Then the gate repeats this for the next person.
    

Summary of the Warm-up Story

Chidi learned that the smart gate makes a decision (open or close) and repeats it for every person. This story introduces decisions and loops.


4. Main Lessons

In this section, you will go through 12 short lessons. Each lesson teaches one big idea. Each lesson ends with a mini summary. Read slowly. Think about the examples. Ask questions. That is how you learn.

Lesson 1 โ€” What is a Decision?

Definition

A decision is a choice between two or more options. In a program, a decision lets the program choose what to do based on a condition.

Why it is important

Without decisions, programs would always do the same thing. They could not react to different situations. Decisions make programs smart.

Simple explanation

Think of walking to school. If it is raining, you take an umbrella. If it is not, you do not. That is a decision.

Real-life example

An ATM makes a decision. If your PIN is correct, it gives you money. If it is wrong, it asks you to try again.

School example

A teacher makes a decision. If a student passes, they move to the next class. If they fail, they repeat.

Home example

Your mother makes a decision. If there is rice at home, she cooks rice. If not, she cooks something else.

Nigerian example

A fuel station makes a decision. If there is fuel in the tank, it sells. If not, it tells customers to wait.

Illustration

    A SIMPLE DECISION
    =================

    [ Is it raining? ]
       /           \
     Yes            No
      |              |
      V              V
    [ Take        [ Do not
      umbrella ]    take umbrella ]
        

Mini summary

A decision is a choice between options. Programs use decisions to react to different situations.


Lesson 2 โ€” True and False

Definition

True and false are the two possible answers to a yes-or-no question. In programming, they are called Boolean values.

Why it is important

Every decision in a program is based on something being true or false. Without true and false, decisions would not work.

Simple explanation

Think of a light switch. It is either ON or OFF. True is like ON. False is like OFF.

Real-life example

"The door is open" is either true or false. The program checks this.

School example

"The student passed the exam" is either true or false. The school's computer checks this to decide the next class.

Home example

"There is milk in the fridge" is either true or false. Your mother checks this before making tea.

Nigerian example

"The bank has enough money" is either true or false. The ATM checks this before giving cash.

Illustration

    TRUE AND FALSE
    ==============

    True:   [ YES ]  [ ON ]   [ Correct ]
    False:  [ NO ]   [ OFF ]  [ Wrong ]

    Every decision checks something: true or false?
        

Mini summary

True and false are the two answers to a yes-or-no question. They are the foundation of every decision.


Lesson 3 โ€” Comparisons

Definition

A comparison checks the relationship between two values. It asks questions like: Are they equal? Is one greater? Is one smaller?

Why it is important

Comparisons give us true or false answers. They are used in every decision.

Simple explanation

Think of weighing two bags of rice. You check: Which one is heavier? That is a comparison.

Common Comparisons

  • Equal to โ€” Is 5 equal to 5? Yes.
  • Not equal to โ€” Is 5 not equal to 3? Yes.
  • Greater than โ€” Is 10 greater than 5? Yes.
  • Less than โ€” Is 3 less than 7? Yes.
  • Greater than or equal to โ€” Is 5 โ‰ฅ 5? Yes.
  • Less than or equal to โ€” Is 3 โ‰ค 3? Yes.

Real-life example

A shop checks: Is the customer's money greater than or equal to the price? If yes, sell. If no, refuse.

School example

A teacher checks: Is the student's score greater than or equal to 50? If yes, pass. If no, fail.

Home example

Your mother checks: Is the pot big enough for the rice? If yes, use it. If no, find a bigger pot.

Nigerian example

A fuel attendant checks: Is the customer's money enough for the litres requested? If yes, pump. If no, ask for less.

Illustration

    COMPARISONS
    ===========

    5 == 5   ->  True   (equal)
    5 != 3   ->  True   (not equal)
    10 > 5   ->  True   (greater)
    3 < 7    ->  True   (less)
    5 >= 5   ->  True   (greater or equal)
    3 <= 3   ->  True   (less or equal)
        

Mini summary

Comparisons check relationships between values. They give true or false answers used in decisions.


Lesson 4 โ€” If Statements

Definition

An if statement is a way to tell the program: "If this is true, do that."

Why it is important

If statements are the most common way to make decisions in programming.

Simple explanation

Think of a rule: "If you finish your homework, you can watch TV." The if statement checks the condition and acts.

Example in Pseudocode

    IF it is raining THEN
      take an umbrella
    END IF
        

Real-life example

An ATM: IF the PIN is correct, THEN give money.

School example

IF a student's score is 50 or more, THEN mark as passed.

Home example

IF there is no milk, THEN buy milk.

Nigerian example

IF it is a public holiday, THEN the bank will be closed.

Illustration

    IF STATEMENT
    ============

    [ Is the condition true? ]
       /                  \
     Yes                   No
      |                     |
      V                     V
    [ Do the action ]    [ Skip the action ]

    Example: IF it is raining, THEN take umbrella.
        

Mini summary

An if statement tells the program: "If this is true, do that." It is the most common way to make decisions.


Lesson 5 โ€” Else Statements

Definition

An else statement tells the program what to do if the if condition is false.

Why it is important

Without else, the program would do nothing when the condition is false. Else gives the program a second option.

Simple explanation

Think of a rule: "If you finish your homework, you can watch TV. Else, you must study." The else gives the second option.

Example in Pseudocode

    IF it is raining THEN
      take an umbrella
    ELSE
      wear a hat
    END IF
        

Real-life example

An ATM: IF the PIN is correct, THEN give money. ELSE, show an error.

School example

IF a student's score is 50 or more, THEN mark as passed. ELSE, mark as failed.

Home example

IF there is no milk, THEN buy milk. ELSE, make tea.

Nigerian example

IF the fuel queue is short, THEN join it. ELSE, come back later.

Illustration

    IF-ELSE STATEMENT
    =================

    [ Is the condition true? ]
       /                  \
     Yes                   No
      |                     |
      V                     V
    [ Do action A ]      [ Do action B ]

    Example: IF it is raining, THEN take umbrella.
             ELSE, wear a hat.
        

Mini summary

An else statement tells the program what to do when the if condition is false. It gives a second option.


Lesson 6 โ€” Else If Statements

Definition

An else if statement lets the program check more than one condition. It is used when there are more than two options.

Why it is important

Many real-world decisions have more than two options. Else if handles these.

Simple explanation

Think of grading: If score is 70 or more, grade A. Else if 60 or more, grade B. Else if 50 or more, grade C. Else, fail.

Example in Pseudocode

    IF score >= 70 THEN
      grade = A
    ELSE IF score >= 60 THEN
      grade = B
    ELSE IF score >= 50 THEN
      grade = C
    ELSE
      grade = F
    END IF
        

Real-life example

A traffic light: IF green, go. ELSE IF yellow, slow down. ELSE (red), stop.

School example

A school grading system: IF 70+, A. ELSE IF 60+, B. ELSE IF 50+, C. ELSE, F.

Home example

IF there is rice, cook rice. ELSE IF there is beans, cook beans. ELSE, buy food.

Nigerian example

IF the queue is short, join. ELSE IF the queue is medium, wait. ELSE, come back later.

Illustration

    ELSE IF CHAIN
    =============

    [ Score >= 70? ]
       /          \
     Yes           No
      |             |
      V             V
    [ Grade A ]  [ Score >= 60? ]
                    /         \
                  Yes          No
                   |            |
                   V            V
                [ Grade B ] [ Score >= 50? ]
                              /         \
                            Yes          No
                             |            |
                             V            V
                          [ Grade C ] [ Grade F ]
        

Mini summary

Else if lets the program check more than one condition. It is used when there are more than two options.


Lesson 7 โ€” What is a Loop?

Definition

A loop is a way to repeat a set of steps many times. It saves you from writing the same steps again and again.

Why it is important

Without loops, programs would be very long. Loops make programs shorter and smarter.

Simple explanation

Think of brushing your teeth. You do not brush just once. You brush each tooth one by one. That is a loop.

Real-life example

A washing machine repeats the wash, rinse, and spin cycle. That is a loop.

School example

A teacher marks 30 exam papers one by one. That is a loop.

Home example

Your mother washes 10 plates one by one. That is a loop.

Nigerian example

A trader sells 50 bags of rice to different customers one by one. That is a loop.

Illustration

    LOOP CONCEPT
    ============

    [ Start ]
        |
        V
    [ Do the task ]
        |
        V
    [ More to do? ]
       /        \
     Yes         No
      |           |
      +--> repeat |
                  V
                [ End ]
        

Mini summary

A loop repeats a set of steps. It saves time and makes programs shorter.


Lesson 8 โ€” Repeat Loops

Definition

A repeat loop repeats a set of steps a fixed number of times. You tell the program how many times to repeat.

Why it is important

Repeat loops are simple and useful. You use them when you know exactly how many times to repeat.

Simple explanation

Think of doing 10 push-ups. You know the number. So you repeat 10 times.

Example in Pseudocode

    REPEAT 5 TIMES
      clap your hands
    END REPEAT
        

Real-life example

A music player repeats a song 3 times. You set the number.

School example

A teacher asks students to write a sentence 10 times. That is a repeat loop.

Home example

Your mother stirs the pot 20 times. That is a repeat loop.

Nigerian example

A football player does 50 sit-ups. That is a repeat loop.

Illustration

    REPEAT LOOP
    ===========

    [ Set count = 1 ]
          |
          V
    [ Do the task ]
          |
          V
    [ count = count + 1 ]
          |
          V
    [ Is count > 5? ]
       /          \
     No            Yes
      |              |
      +--> repeat    V
                   [ End ]

    Example: Clap 5 times.
        

Mini summary

A repeat loop repeats steps a fixed number of times. You tell the program how many times.


Lesson 9 โ€” While Loops

Definition

A while loop repeats a set of steps as long as a condition is true. It stops when the condition becomes false.

Why it is important

While loops are used when you do not know exactly how many times to repeat. You repeat until something changes.

Simple explanation

Think of waiting for a bus. While the bus has not arrived, you keep waiting. When it arrives, you stop waiting.

Example in Pseudocode

    WHILE there is water in the bucket
      scoop water
    END WHILE
        

Real-life example

A phone charges. While the battery is not full, keep charging.

School example

While there are exam papers, keep marking.

Home example

While there are dirty plates, keep washing.

Nigerian example

While there is fuel in the tank, keep selling.

Illustration

    WHILE LOOP
    ==========

    [ Check condition ]
          |
          V
    [ Is it true? ]
       /        \
     Yes         No
      |           |
      V           V
    [ Do task ]  [ End ]
      |
      +--> check condition again

    Example: WHILE water remains, scoop water.
        

Mini summary

A while loop repeats as long as a condition is true. It stops when the condition becomes false.


Lesson 10 โ€” For Loops

Definition

A for loop repeats steps a specific number of times, like a repeat loop. But it is more powerful. It can count and use the count.

Why it is important

For loops are used for counting, listing, and going through items one by one.

Simple explanation

Think of counting from 1 to 10. You say 1, 2, 3, and so on. A for loop does that.

Example in Pseudocode

    FOR number FROM 1 TO 10
      print number
    END FOR
        

Real-life example

A teacher calls roll numbers 1 to 30. That is a for loop.

School example

A student reads pages 1 to 20 of a book. That is a for loop.

Home example

Your mother counts 12 eggs in a tray. That is a for loop.

Nigerian example

A bus conductor counts 14 passengers. That is a for loop.

Illustration

    FOR LOOP
    ========

    FOR count FROM 1 TO 5
      print "Hello"
    NEXT count

    This prints "Hello" 5 times.

    Count:   1    2    3    4    5
           Hello Hello Hello Hello Hello
        

Mini summary

A for loop repeats steps a specific number of times. It is used for counting and listing.


Lesson 11 โ€” When to Use Decisions and Loops

Definition

Decisions are used when the program must choose. Loops are used when the program must repeat. Knowing when to use each is a key skill.

Why it is important

Using the wrong one makes programs confusing. Choosing the right one makes programs simple and clear.

Simple explanation

Think of a traffic light. It chooses between green, yellow, and red (decision). It also repeats the cycle (loop).

When to Use

Use a Decision When... Use a Loop When...
There are options There is repetition
The program must choose The program must repeat
Example: If it rains Example: For each student

Real-life example

A shop uses a decision: If a customer has money, sell. It uses a loop: For each item in the cart, calculate the price.

School example

A teacher uses a decision: If the score is above 50, pass. She uses a loop: For each student, mark the paper.

Home example

Your mother uses a decision: If there is no milk, buy more. She uses a loop: For each plate, wash it.

Nigerian example

A fuel attendant uses a decision: If the tank is empty, stop selling. He uses a loop: For each customer, pump fuel.

Illustration

    DECISION vs LOOP
    ================

    Decision:                  Loop:
    [ Choose A or B ]          [ Repeat this task ]
        |                          |
        V                          V
    One action                 Many actions

    Sometimes you need both!
        

Mini summary

Use decisions when the program must choose. Use loops when the program must repeat. Often you need both.


Lesson 12 โ€” Combining Decisions and Loops

Definition

Many programs use decisions inside loops. This means each time the loop runs, the program makes a decision.

Why it is important

Combining decisions and loops lets you handle complex tasks. It is the way real programs work.

Simple explanation

Think of a teacher marking exam papers. For each paper (loop), she checks if the score is above 50 (decision).

Example in Pseudocode

    FOR each student in the class
      IF student score >= 50 THEN
        mark student as passed
      ELSE
        mark student as failed
      END IF
    END FOR
        

Real-life example

A bank goes through each transaction (loop). If the amount is over โ‚ฆ1,000,000, it flags the transaction for review (decision).

School example

A school goes through each student (loop). If the fees are paid, the student can sit for exams (decision).

Home example

Your mother goes through each item in the fridge (loop). If it is expired, she throws it away (decision).

Nigerian example

A bus conductor goes through each passenger (loop). If the passenger has paid, he gives a ticket (decision).

Illustration

    DECISION INSIDE A LOOP
    ======================

    FOR each item
        |
        V
    [ Check condition ]
       /          \
     Yes           No
      |             |
      V             V
    [ Action A ] [ Action B ]
      |             |
      +------+------+
             |
             V
    [ Next item ]
        

Mini summary

Many programs use decisions inside loops. Each time the loop runs, the program makes a decision.

Summary of Main Lessons

You have now learned the core ideas of Module 2: what decisions are, true and false, comparisons, if statements, else and else if, what loops are, repeat loops, while loops, for loops, when to use decisions and loops, and how to combine them.


5. Key Vocabulary

Word Simple Definition
Decision A choice between two or more options.
Condition Something that is either true or false.
True Yes, correct, or on.
False No, wrong, or off.
Boolean A value that is either true or false.
Comparison Checking the relationship between two values.
If statement Do something if a condition is true.
Else statement Do something if the condition is false.
Else if statement Check another condition if the first is false.
Loop Repeating a set of steps.
Repeat loop Repeat a fixed number of times.
While loop Repeat as long as a condition is true.
For loop Repeat a specific number of times, often counting.
Counter A number that keeps track of how many times something happens.
Infinite loop A loop that never stops.

Summary of Key Vocabulary

These words will help you understand decisions and loops. Use them often so they become easy.


6. Important Concepts

Concept 1 โ€” Decisions Make Programs Smart

Decisions let programs react to different situations. Without them, programs would always do the same thing.

Concept 2 โ€” True and False Are the Foundation

Every decision checks something that is either true or false.

Concept 3 โ€” Loops Save Time

Loops repeat steps. They make programs shorter and easier to write.

Concept 4 โ€” Choose the Right Loop

Use repeat loops when you know the count. Use while loops when you do not.

Concept 5 โ€” Combine Decisions and Loops

Real programs often use decisions inside loops. This lets them handle complex tasks.

Summary of Important Concepts

These five concepts are the heart of Module 2. Read them again before moving on.


7. Step-by-step Explanations

Step-by-step: How to Write an If-Else in Pseudocode

  1. Identify the condition. What are you checking?
  2. Write the IF line. IF condition THEN.
  3. Write the action. What to do if true.
  4. Write the ELSE line. What to do if false.
  5. End with END IF. Close the decision.
  6. Test it. Try different conditions.
    WRITING AN IF-ELSE
    ==================

    IF score >= 50 THEN
      print "Passed"
    ELSE
      print "Failed"
    END IF
    

Step-by-step: How to Write a While Loop in Pseudocode

  1. Identify the condition. What must be true to keep looping?
  2. Write the WHILE line. WHILE condition.
  3. Write the actions. What to do inside the loop.
  4. Make sure something changes. Otherwise it will loop forever.
  5. End with END WHILE. Close the loop.
  6. Test it. Check if it stops at the right time.
    WRITING A WHILE LOOP
    ====================

    count = 1
    WHILE count <= 5
      print count
      count = count + 1
    END WHILE
    

Step-by-step: How to Draw a Decision Flowchart

  1. Start with an oval. Write "Start".
  2. Add a rectangle for the first step.
  3. Add a diamond for the decision.
  4. Label the arrows "Yes" and "No".
  5. Add rectangles for actions after each arrow.
  6. End with an oval. Write "End".
    DECISION FLOWCHART
    ==================

    ( Start )
        |
        V
    [ Read score ]
        |
        V
    < Score >= 50? >
      /          \
    Yes           No
     |             |
     V             V
    [ Print ]   [ Print ]
    [ Passed ]  [ Failed ]
     |             |
     +------+------+
            |
            V
         ( End )
    

Summary of Step-by-step Explanations

Writing decisions and loops, and drawing flowcharts, all follow clear steps. Following steps makes it easy.


8. Real-life Examples

Example 1 โ€” Traffic Light

A traffic light uses decisions: If green, go. Else if yellow, slow down. Else, stop. It also loops through the colours repeatedly.

Example 2 โ€” ATM

An ATM uses decisions: If PIN is correct, allow. Else, reject. It also loops: For each transaction, process it.

Example 3 โ€” Washing Machine

A washing machine uses a loop: While there is water, keep washing. If the timer ends, stop.

Example 4 โ€” Online Shopping Cart

An online cart uses a loop: For each item, add the price. It uses a decision: If the total is over โ‚ฆ50,000, give free delivery.

Example 5 โ€” Music Player

A music player uses a loop: For each song in the playlist, play it. If the user presses stop, stop.

Summary of Real-life Examples

Decisions and loops appear in traffic lights, ATMs, washing machines, shopping carts, and music players.


9. Nigerian Examples

Example 1 โ€” Buying Airtime

Decision: If you entered the right PIN, airtime is added. Else, an error message appears.

Example 2 โ€” Bank Transfer

Decision: If your balance is enough, the transfer goes through. Else, the transfer fails.

Example 3 โ€” POS Payment

Loop: For each item, add the price. Decision: If the total is correct, confirm payment.

Example 4 โ€” Fuel Station

Loop: For each customer, pump fuel. Decision: If the tank is empty, stop selling.

Example 5 โ€” School Result Portal

Loop: For each subject, check the score. Decision: If the score is 50 or more, mark as pass.

Summary of Nigerian Examples

Nigeria has many examples of decisions and loops: airtime, bank transfers, POS, fuel stations, and school portals.


10. Fun Examples Children Can Relate To

Example 1 โ€” Video Games

Decision: If the player touches an enemy, lose a life. Loop: For each level, load the level.

Example 2 โ€” Choosing Clothes

Decision: If it is cold, wear a jacket. Else, wear a T-shirt.

Example 3 โ€” Playing Hide and Seek

Loop: Count to 20. Decision: If you find everyone, the game ends.

Example 4 โ€” Making a Sandwich

Decision: If you have cheese, add cheese. Else, skip it. Loop: For each slice, add filling.

Example 5 โ€” Sharing Sweets

Loop: For each friend, give one sweet. Decision: If there are no sweets left, stop.

Summary of Fun Examples

Decisions and loops appear in video games, choosing clothes, hide and seek, sandwiches, and sharing sweets.


11. Everyday Examples

Task Decision Loop
Brushing teeth If tooth is clean, move on For each tooth
Charging phone If charged, unplug While not full, keep charging
Cooking rice If soft, serve While cooking, stir
Going to school If raining, take umbrella For each subject, attend class
Sending a text If recipient exists, send For each message, send

Summary of Everyday Examples

Even simple daily activities use decisions and loops. Now you can see them everywhere.


12. Parent Tips

  1. Point out decisions in daily life. "If it rains, we take an umbrella."
  2. Point out loops. "We wash each plate one by one."
  3. Ask your child to spot decisions. In a game, in a movie, in a chore.
  4. Play decision games. "If I say red, jump. If I say blue, sit."
  5. Play loop games. "Clap 5 times. Now clap until I say stop."
  6. Practise pseudocode. Ask your child to write "IF... ELSE" for a daily rule.
  7. Praise clear thinking. When your child explains a decision, praise them.
  8. Be patient. Logical thinking takes practice.

Summary of Parent Tips

Parents can help children learn decisions and loops through daily activities and simple games.


13. Interesting Facts

  1. The if statement is one of the oldest ideas in programming.
  2. Loops can repeat millions of times in a second.
  3. Without loops, some programs would be millions of lines long.
  4. Infinite loops are one of the most common programming mistakes.
  5. Traffic lights use loops and decisions together.
  6. Some computer games use thousands of loops every second.
  7. The concept of true and false is called Boolean logic, named after a mathematician called George Boole.
  8. In Nigeria, many tech companies teach if-statements and loops in their first coding lessons.

Summary of Interesting Facts

Decisions and loops are powerful, old, and used everywhere.


14. Did You Know?

  • Did you know that every decision in a program uses true or false?
  • Did you know that a single loop can save hundreds of lines of code?
  • Did you know that the first computers had no loops, and programmers had to write every step by hand?
  • Did you know that traffic lights, elevators, and washing machines all use decisions and loops?
  • Did you know that an infinite loop can freeze a whole program?
  • Did you know that "else if" is sometimes called "elif" in some programming languages?

Summary of Did You Know?

Decisions and loops are full of surprises. The more you learn, the more interesting they become.


15. Remember This

  • A decision is a choice between options.
  • Every decision uses true or false.
  • Comparisons check relationships between values.
  • An if statement runs when a condition is true.
  • An else statement runs when a condition is false.
  • An else if statement checks another condition.
  • A loop repeats a set of steps.
  • Repeat loops repeat a fixed number of times.
  • While loops repeat as long as a condition is true.
  • For loops repeat a specific number of times, often counting.

Summary of Remember This

These ten points are the heart of Module 2. Read them again before moving on.


16. Common Mistakes

  1. Forgetting the else. Without else, the program does nothing when the condition is false.
  2. Using the wrong comparison. Using "greater than" when you mean "greater than or equal to".
  3. Writing an infinite loop. A loop that never stops.
  4. Not changing the condition inside a while loop. This creates an infinite loop.
  5. Using a loop when a decision is needed. They are different.
  6. Forgetting to close loops or if statements. Use END IF and END LOOP.
  7. Making conditions too complex. Keep them simple.
  8. Giving up too soon. Logic takes practice.

Summary of Common Mistakes

Avoiding these mistakes will make you a better logical thinker than many adults.


17. Best Practices

  1. Keep conditions simple and clear.
  2. Always include an else when there is another option.
  3. Use else if for multiple options.
  4. Make sure loops change something, so they stop.
  5. Choose the right loop for the task.
  6. Test your code with different values.
  7. Draw flowcharts for decisions and loops.
  8. Write pseudocode before real code.
  9. Look for loops and decisions in daily life.
  10. Practice every day.

Summary of Best Practices

These ten practices will help you write better decisions and loops.


18. ASCII Illustrations, Diagrams, Flowcharts, and Timelines

Diagram 1 โ€” A Simple Decision

    A SIMPLE DECISION
    =================

    [ Is it raining? ]
       /           \
     Yes            No
      |              |
      V              V
    [ Take        [ Do not
      umbrella ]    take umbrella ]
    

Diagram 2 โ€” True and False

    TRUE AND FALSE
    ==============

    True:   [ YES ]  [ ON ]   [ Correct ]
    False:  [ NO ]   [ OFF ]  [ Wrong ]
    

Diagram 3 โ€” If-Else Statement

    IF-ELSE STATEMENT
    =================

    [ Is the condition true? ]
       /                  \
     Yes                   No
      |                     |
      V                     V
    [ Do action A ]      [ Do action B ]
    

Diagram 4 โ€” Else If Chain

    ELSE IF CHAIN
    =============

    [ Score >= 70? ]
       /          \
     Yes           No
      |             |
      V             V
    [ Grade A ]  [ Score >= 60? ]
                    /         \
                  Yes          No
                   |            |
                   V            V
                [ Grade B ] [ Score >= 50? ]
                              /         \
                            Yes          No
                             |            |
                             V            V
                          [ Grade C ] [ Grade F ]
    

Diagram 5 โ€” While Loop

    WHILE LOOP
    ==========

    [ Check condition ]
          |
          V
    [ Is it true? ]
       /        \
     Yes         No
      |           |
      V           V
    [ Do task ]  [ End ]
      |
      +--> check condition again
    

Diagram 6 โ€” Decision Inside a Loop

    DECISION INSIDE A LOOP
    ======================

    FOR each item
        |
        V
    [ Check condition ]
       /          \
     Yes           No
      |             |
      V             V
    [ Action A ] [ Action B ]
      |             |
      +------+------+
             |
             V
    [ Next item ]
    

Summary of Illustrations

These diagrams help you see decisions and loops clearly. Draw them yourself to remember them better.


19. Comparison Tables

Table 1 โ€” If vs Else If vs Else

If Else If Else
Checks the first condition Checks another condition Runs when all conditions are false
Runs if true Runs if the first was false but this one is true Runs always as the last option
One per decision Can have many One per decision

Table 2 โ€” Repeat vs While vs For

Repeat Loop While Loop For Loop
Fixed number of times Until a condition is false Fixed number, with counting
You know the count You do not know the count You know the range
Example: Clap 5 times Example: While water remains Example: Count from 1 to 10

Table 3 โ€” Decision vs Loop

Decision Loop
Chooses between options Repeats steps
Uses true or false Uses a condition too
Runs once per check Runs many times
Example: If it rains Example: For each student

Summary of Comparison Tables

Comparing ideas side by side helps you remember the differences clearly.


20. Summary After Every Lesson (Consolidated)

Lesson Main Idea
Lesson 1 A decision is a choice between options.
Lesson 2 True and false are the two answers to a yes-or-no question.
Lesson 3 Comparisons check relationships between values.
Lesson 4 An if statement runs when a condition is true.
Lesson 5 An else statement runs when a condition is false.
Lesson 6 An else if statement checks another condition.
Lesson 7 A loop repeats a set of steps.
Lesson 8 Repeat loops repeat a fixed number of times.
Lesson 9 While loops repeat as long as a condition is true.
Lesson 10 For loops repeat a specific number of times, often counting.
Lesson 11 Use decisions to choose, and loops to repeat.
Lesson 12 Real programs combine decisions and loops.

21. End-of-Module Summary

Congratulations! You have completed Module 2. Let us review what you have learned.

You began by learning that a decision is a choice between options. Programs use decisions to react to different situations.

You learned about true and false, the two answers to a yes-or-no question. Every decision checks something that is either true or false.

You explored comparisons โ€” equal, not equal, greater than, less than, and more.

You learned how to write if statements โ€” "If this is true, do that."

You added else and else if to handle more options.

You discovered loops โ€” ways to repeat steps. You learned about repeat loops, while loops, and for loops.

You learned when to use decisions and when to use loops. You also learned how to combine them.

    MODULE 2 SUMMARY MAP
    ====================

    [ Decision ] --> [ True / False ] --> [ Comparisons ]
              |
              V
    [ If ] --> [ Else ] --> [ Else If ]
              |
              V
    [ Loop ] --> [ Repeat ] --> [ While ] --> [ For ]
              |
              V
    [ Decision + Loop Together! ]
    

Well done! You now understand how programs make decisions and repeat tasks. In Module 3, you will learn how programs store and use information.


22. Frequently Asked Questions (10 Questions)

Question 1: What is a decision in programming?

A decision is a choice between two or more options. Programs use decisions to react to different situations.

Question 2: What is true and false?

True and false are the two answers to a yes-or-no question. They are the foundation of every decision.

Question 3: What is a comparison?

A comparison checks the relationship between two values. It asks: Are they equal? Is one greater? Is one smaller?

Question 4: What is an if statement?

An if statement tells the program: "If this is true, do that."

Question 5: What is an else statement?

An else statement tells the program what to do when the if condition is false.

Question 6: What is an else if statement?

An else if statement lets the program check more than one condition. It is used when there are more than two options.

Question 7: What is a loop?

A loop is a way to repeat a set of steps many times.

Question 8: What is the difference between a repeat loop and a while loop?

A repeat loop repeats a fixed number of times. A while loop repeats as long as a condition is true.

Question 9: What is an infinite loop?

An infinite loop is a loop that never stops. It happens when the condition never becomes false.

Question 10: Can I use decisions and loops in daily life?

Yes! You already use them for cooking, dressing, playing games, and many other tasks.


23. Matching Exercises

Exercise 1 โ€” Match the Word to the Meaning

Column A (Word) Column B (Meaning)
1. Decision A. Repeat a fixed number of times
2. If statement B. A choice between options
3. Loop C. Run when a condition is true
4. Repeat loop D. Run when a condition is false
5. Else statement E. Repeat a set of steps

Answers: 1-B, 2-C, 3-E, 4-A, 5-D

Exercise 2 โ€” Match the Task to Its Type

Column A (Task) Column B (Type)
1. If it rains, take umbrella A. While loop
2. For each student, mark paper B. For loop
3. While water remains, scoop C. If statement
4. Clap 5 times D. Repeat loop

Answers: 1-C, 2-B, 3-A, 4-D

Summary of Matching Exercises

Matching helps you connect words to meanings quickly.


24. Scenario-based Exercises

Scenario 1 โ€” The Silent ATM

A customer enters the wrong PIN at an ATM. The ATM does nothing. No message appears. The customer is confused.

Questions:

  1. What is missing in the program?
  2. What should the ATM do?
  3. Write pseudocode for the correct behaviour.

Scenario 2 โ€” The Endless Song

A music player keeps playing the same song forever. The user cannot stop it.

Questions:

  1. What kind of mistake is this?
  2. How could the programmer fix it?
  3. What is the name of this mistake?

Scenario 3 โ€” The Missed Decision

A shopping website always gives free delivery, even when the order is small. The company is losing money.

Questions:

  1. What decision is missing?
  2. How should the program check?
  3. Write pseudocode for the correct decision.

Summary of Scenario-based Exercises

These scenarios help you apply what you have learned to real situations.


25. Group Activity

Activity: Design a Decision Flowchart for a Game

Group size: 3โ€“5 students

Time: 40 minutes

Materials: Paper, pencil, ruler

Instructions:

  1. Choose a simple game (e.g., guess the number, rock-paper-scissors).
  2. Write the rules as decisions (if, else).
  3. Include at least one loop (repeat until the game ends).
  4. Draw a flowchart using ovals, rectangles, and diamonds.
  5. Present your flowchart to the class.

Goal: To practise decisions and loops together.


26. Individual Activity

Activity: My Day in Decisions and Loops

Time: 20 minutes

Materials: Notebook, pencil

Instructions:

  1. Write three decisions you made today (using if/else).
  2. Write three loops you did today (like brushing each tooth).
  3. Draw a simple flowchart for one decision.
  4. Draw a simple flowchart for one loop.

Goal: To connect decisions and loops to your own daily life.


27. Mini Project

Project: Design a Simple Quiz Program on Paper

Time: 1โ€“2 hours

Materials: Paper, pencil, ruler

Instructions:

  1. Choose 5 simple questions (e.g., maths or general knowledge).
  2. Write pseudocode that asks each question in a loop.
  3. Inside the loop, use a decision: If the answer is correct, add 1 to the score.
  4. After the loop, use a decision: If the score is 3 or more, say "Well done". Else, say "Try again".
  5. Draw a flowchart of your program.
  6. Present your project to the class.

Goal: To practise decisions and loops together.


28. Practical Assignment

Assignment: Observe Decisions and Loops in Real Life

Time: 1 week

Materials: Notebook, pencil

Instructions:

  1. For one week, look for decisions and loops in daily life.
  2. Write down at least 5 examples of each.
  3. For one decision, write pseudocode using if/else.
  4. For one loop, write pseudocode using while or for.
  5. Write a short report on what you learned.

Goal: To see how decisions and loops appear in real life.


29. Key Takeaways

  1. A decision is a choice between options.
  2. Every decision uses true or false.
  3. Comparisons check relationships between values.
  4. If statements run when a condition is true.
  5. Else statements run when a condition is false.
  6. Else if statements check another condition.
  7. Loops repeat a set of steps.
  8. Repeat loops repeat a fixed number of times.
  9. While loops repeat as long as a condition is true.
  10. For loops repeat a specific number of times, often counting.

30. Classroom Discussion Questions

  1. Why do programs need decisions?
  2. What would happen if a program had no loops?
  3. Can you give an example of a decision you made today?
  4. Can you give an example of a loop you used today?
  5. What is the difference between if and else?
  6. When would you use else if?
  7. What is the difference between a while loop and a for loop?
  8. What happens if a loop never stops?
  9. Why is it useful to combine decisions and loops?
  10. What did you enjoy most in this module?

31. Preparation for the Next Module

You have finished Module 2. Well done! Here is how to prepare for Module 3, which is all about Storing and Using Information.

  1. Review your key words. Make sure you can explain decision, if, else, loop, and while loop in your own words.
  2. Practise writing pseudocode. Write if/else and loops for daily tasks.
  3. Draw flowcharts. Use ovals, rectangles, diamonds, and arrows.
  4. Look for information in daily life. Notice how you store and use information (names, numbers, lists).
  5. Bring your curiosity. Module 3 will teach you about variables, data types, lists, and functions.
    TRANSITION TO MODULE 3
    ======================

    [ Module 2: Making Decisions and Repeating Tasks ]
              |
              V
    [ Module 3: Storing and Using Information ]
              |
              V
    [ You will learn: variables, data types,
      lists, functions, and input/output ]
    

See you in Module 3. Keep thinking like a programmer!


4

Module Three

Module 3 ยท Storing and Using Information

โฌ… Back to Course Outline

๐Ÿ—ƒ๏ธ Module 3 โ€” Storing and Using Information

Programming Logic for Web Developers ยท Beginner Level ยท 2026


1. Module Introduction

Welcome to Module 3 โ€” the final module of the Programming Logic for Web Developers course. You have come a long way. In Module 1, you learned how to think in steps. In Module 2, you learned how programs make decisions and repeat tasks.

Now we come to the last piece of the puzzle. Programs must remember things. They must store information. If a program cannot remember your name, your score, or your shopping list, it is not useful.

In this module, you will learn how programs store and use information. You will learn about variables โ€” boxes that hold information. You will learn about data types โ€” the different kinds of information. You will learn about lists and arrays โ€” ways to store many things together. You will learn about functions โ€” reusable blocks of steps. And you will learn about input and output โ€” how programs receive and send information.

Do not worry if these words sound new. Every word will be explained in very simple language. Every idea will come with examples from real life, school, home, and Nigeria.

This is the last module. Take your time. Enjoy it. By the end, you will have all the logic skills you need to start learning HTML, CSS, and JavaScript.

    YOUR LEARNING JOURNEY IN MODULE 3
    =================================

    [ Start ]
        |
        V
    What are Variables?
        |
        V
    What are Data Types?
        |
        V
    Numbers, Text, and True/False
        |
        V
    What are Lists?
        |
        V
    What are Functions?
        |
        V
    What is Input and Output?
        |
        V
    [ You can now store and use information! ]
    

Summary of the Introduction

This module teaches you how programs store and use information. You will learn about variables, data types, lists, functions, and input/output.


2. Learning Objectives

By the end of this module, you will be able to:

  1. Explain what a variable is in your own words.
  2. Explain what a data type is and why it matters.
  3. Describe the three main data types: numbers, text, and true/false.
  4. Explain what a list or array is.
  5. Explain what a function is and why functions are useful.
  6. Explain what input and output mean.
  7. Write simple pseudocode that stores and uses information.
  8. Give examples of variables, lists, and functions in real life.
  9. Draw a simple diagram showing how information flows in a program.
  10. Feel confident and ready to start learning real programming languages.

Summary of Learning Objectives

You will learn how programs store information (variables, lists) and how they use it (functions, input/output). You will also learn about data types.


3. Warm-up Story โ€” Amina's School Bag

Amina is a 13-year-old girl who lives in Kano. One morning, she packed her school bag for the day.

She put her Maths textbook in one pocket. She put her English textbook in another pocket. She put her pencil case in the front. She put her lunchbox in the side. She put her water bottle in the other side.

When she got to school, she knew exactly where everything was. When the teacher asked for Maths, she opened the Maths pocket. When she wanted lunch, she opened the lunch side.

Her friend, Fatima, was not so organised. She had thrown everything into one big bag. When the teacher asked for Maths, she spent five minutes searching. When she wanted water, she could not find it.

"Amina, how do you always know where everything is?" Fatima asked.

Amina smiled. "Each thing has its own place. I gave each item a name. When I need something, I just call its name."

Fatima thought about it. "So if I put Maths in a pocket called 'MathsBook', I just say, 'Open MathsBook', and I find it?"

"Exactly," Amina said. "That is how computers work too. Every piece of information gets a name. When the program needs it, it calls the name."

Fatima smiled. She had learned something important. Information needs a place and a name. That is what programming is all about.

    AMINA'S SCHOOL BAG
    ==================

    [ MathsBook ]     <- a variable holding a Maths book
    [ EnglishBook ]   <- a variable holding an English book
    [ PencilCase ]    <- a variable holding pencils
    [ LunchBox ]      <- a variable holding lunch
    [ WaterBottle ]   <- a variable holding water

    Each item has a name. You call the name to get the item.
    

Summary of the Warm-up Story

Amina organised her school bag by giving each item a name and a place. Computers do the same with variables. This story introduces the whole module.


4. Main Lessons

In this section, you will go through 12 short lessons. Each lesson teaches one big idea. Each lesson ends with a mini summary. Read slowly. Think about the examples. Ask questions. That is how you learn.

Lesson 1 โ€” What is a Variable?

Definition

A variable is a named box that stores information in a program. You give it a name, put something inside, and use it later.

Why it is important

Without variables, programs could not remember anything. They would forget your name, your score, and your shopping list.

Simple explanation

Think of a labelled jar in a kitchen. One jar says "Sugar". Another says "Salt". You open the right jar when you need it. A variable is like a labelled jar.

Real-life example

In a game, the score is stored in a variable called "score". Every time you win a point, the score increases.

School example

A student's name is stored in a variable called "studentName". The school uses it to print certificates.

Home example

Your family's monthly budget is stored in a variable called "budget". Every time you spend, the budget decreases.

Nigerian example

A bank stores your account balance in a variable called "balance". When you deposit money, the balance increases.

Illustration

    VARIABLES ARE LIKE LABELLED JARS
    ================================

    [ Sugar ]   <- variable holding sugar
    [ Salt ]    <- variable holding salt
    [ Rice ]    <- variable holding rice

    In a program:
      score = 0
      name = "Amina"
      balance = 5000
    

Mini summary

A variable is a named box that stores information. You give it a name, put something inside, and use it later.


Lesson 2 โ€” Naming Variables

Definition

Naming a variable means choosing a clear word to identify it. A good name helps you remember what the variable holds.

Why it is important

If you name a variable badly, you will get confused. Good names make programs easy to read and understand.

Simple explanation

Think of naming a pet. If you call your dog "Dog", it is confusing. If you call it "Rex", it is clear. Variables are the same.

Rules for Good Names

  • Use clear words: studentName is better than sn.
  • Do not use spaces. Use underscores or capital letters: student_name or studentName.
  • Start with a letter, not a number.
  • Do not use words the programming language already uses.
  • Keep names short but clear.

Real-life example

A game stores the player's score in a variable called "playerScore", not just "x".

School example

A school stores each student's name in a variable called "studentName", and their score in "studentScore".

Home example

Your family stores its shopping list in a variable called "shoppingList".

Nigerian example

A bank stores your balance in a variable called "accountBalance". It stores your account number in "accountNumber".

Illustration

    GOOD NAMES vs BAD NAMES
    =======================

    Bad:   x = 5000           (What is x?)

    Good:  accountBalance = 5000   (Clear!)

    Bad:   a = "Amina"        (What is a?)

    Good:  studentName = "Amina"   (Clear!)
    

Mini summary

Good variable names are clear, short, and describe what the variable holds. Bad names cause confusion.


Lesson 3 โ€” What is a Data Type?

Definition

A data type tells the program what kind of information is stored in a variable. The three main types are numbers, text, and true/false.

Why it is important

Different types of information behave differently. You can add numbers. You cannot add text the same way. Knowing the type helps you use it correctly.

Simple explanation

Think of a kitchen. You have dry foods, wet foods, and frozen foods. Each is stored differently. Data types are like that for information.

The Three Main Types

  • Number โ€” like 5, 100, or 3.14
  • Text โ€” like "Amina", "Hello", or "Lagos"
  • True/False โ€” either true or false

Real-life example

A person's age is a number. Their name is text. Whether they are married is true or false.

School example

A student's score is a number. Their name is text. Whether they passed is true or false.

Home example

The number of eggs in a tray is a number. The shopping list is text. Whether the milk is finished is true or false.

Nigerian example

Your account balance is a number. Your account name is text. Whether your account is active is true or false.

Illustration

    THREE DATA TYPES
    ================

    Number:      age = 13
                 balance = 5000
                 price = 250.50

    Text:        name = "Amina"
                 city = "Kano"
                 message = "Hello"

    True/False:  isRaining = true
                 isPassed = false
                 hasPaid = true
    

Mini summary

A data type tells the program what kind of information is stored. The three main types are numbers, text, and true/false.


Lesson 4 โ€” Numbers as Data

Definition

Numbers are a data type used for counting, measuring, and calculating. Numbers can be whole (like 5) or have decimals (like 3.14).

Why it is important

Numbers are used in almost every program. Scores, prices, ages, and distances are all numbers.

Simple explanation

Think of a market. Prices, quantities, and change are all numbers. You can add them, subtract them, and multiply them.

Real-life example

A shopkeeper calculates the total price of goods. That is using numbers.

School example

A teacher calculates the average score of the class. That is using numbers.

Home example

Your mother calculates how much money to spend on food. That is using numbers.

Nigerian example

A POS machine calculates the total price of items and prints a receipt. That is using numbers.

Illustration

    NUMBERS IN ACTION
    =================

    price = 250
    quantity = 3
    total = price * quantity

    total is now 750.

    Numbers can be added, subtracted, multiplied, and divided.
    

Mini summary

Numbers are used for counting, measuring, and calculating. They can be whole or have decimals.


Lesson 5 โ€” Text as Data

Definition

Text is a data type used for words, letters, and sentences. In programming, text is often called a string.

Why it is important

Names, addresses, and messages are all text. Programs use text to communicate.

Simple explanation

Think of a letter you write. Every word is text. A program uses text the same way.

Real-life example

Your email address is text. Your name is text. Your messages are text.

School example

A student's name and class are text. The school stores them.

Home example

Your shopping list is text. Each item is a word.

Nigerian example

Your bank account name is text. It is stored in the bank's database.

Illustration

    TEXT IN ACTION
    ==============

    name = "Amina Yusuf"
    city = "Kano"
    message = "Hello, how are you?"

    Text is always in quotes: "..."

    You can join text: "Hello, " + "Amina" = "Hello, Amina"
    

Mini summary

Text is used for words, letters, and sentences. In programming, text is often called a string.


Lesson 6 โ€” True/False as Data

Definition

True/False is a data type with only two possible values: true or false. It is used for yes-or-no questions.

Why it is important

Many decisions in programs depend on true or false. For example, "Is the user logged in?" is either true or false.

Simple explanation

Think of a light switch. It is either ON or OFF. True is like ON. False is like OFF.

Real-life example

"The door is open" is true or false. "The milk is finished" is true or false.

School example

"The student has paid fees" is true or false. The school uses it to allow exam registration.

Home example

"The gas cooker is on" is true or false. Your family uses it to be safe.

Nigerian example

"Your BVN is verified" is true or false. The bank uses it before you can open an account.

Illustration

    TRUE / FALSE IN ACTION
    ======================

    isRaining = true
    isLoggedIn = false
    hasPaidFees = true

    If hasPaidFees is true, allow registration.
    If hasPaidFees is false, block registration.
    

Mini summary

True/False is a data type with only two values. It is used for yes-or-no questions.


Lesson 7 โ€” What is a List?

Definition

A list (also called an array) is a way to store many pieces of information in one variable. Each piece is called an item.

Why it is important

Without lists, you would need a separate variable for every item. Lists keep things organised.

Simple explanation

Think of a shopping list. It has many items. You do not have a separate paper for each item. You have one list. Lists in programming work the same way.

Real-life example

A music playlist is a list. It has many songs. A contact list on your phone is a list.

School example

A class register is a list of student names. A timetable is a list of subjects.

Home example

A shopping list is a list of items to buy. A chore list is a list of tasks.

Nigerian example

A bus manifest is a list of passengers. A bank statement is a list of transactions.

Illustration

    A LIST IS LIKE A SHOPPING LIST
    ==============================

    shoppingList = [ "Rice", "Beans", "Oil", "Salt" ]

    Item 1: "Rice"
    Item 2: "Beans"
    Item 3: "Oil"
    Item 4: "Salt"

    You can get any item by its position.
    

Mini summary

A list stores many pieces of information in one variable. Each piece is called an item.


Lesson 8 โ€” Using Lists

Definition

Using a list means adding items, removing items, reading items, and going through each item one by one.

Why it is important

Lists become powerful when you can use them. You can loop through them and do something for each item.

Simple explanation

Think of a teacher with a class register. She calls each name one by one. That is going through a list.

Common List Actions

  • Add โ€” put a new item in the list
  • Remove โ€” take an item out of the list
  • Read โ€” get an item by its position
  • Loop โ€” go through each item
  • Count โ€” find how many items are in the list

Real-life example

A music player goes through each song in the playlist and plays it one by one.

School example

A teacher goes through each name on the class register and marks attendance.

Home example

Your mother goes through each item on the shopping list and ticks it off as she buys it.

Nigerian example

A bus conductor goes through each passenger on the manifest and gives a ticket.

Illustration

    USING A LIST
    ============

    shoppingList = [ "Rice", "Beans", "Oil", "Salt" ]

    FOR each item in shoppingList
      print item
    END FOR

    Output:
      Rice
      Beans
      Oil
      Salt
    

Mini summary

Using a list means adding, removing, reading, and looping through items. Lists are powerful when combined with loops.


Lesson 9 โ€” What is a Function?

Definition

A function is a block of steps that you can use again and again. You give it a name and call it whenever you need it.

Why it is important

Functions save time. Instead of writing the same steps many times, you write them once and call them.

Simple explanation

Think of a recipe. Once you know the recipe, you can cook the same dish anytime. A function is a recipe for a program.

Real-life example

A calculator has a "square root" button. You press it and it does the calculation. That is a function.

School example

A teacher has a routine for marking attendance. She follows the same steps each day. That is a function.

Home example

Your mother has a recipe for jollof rice. She uses the same steps each time. That is a function.

Nigerian example

A POS machine has a "calculate total" function. Every time a customer buys something, it uses the same function.

Illustration

    A FUNCTION IS LIKE A RECIPE
    ===========================

    FUNCTION greet(name)
      print "Hello, " + name
    END FUNCTION

    greet("Amina")   -> "Hello, Amina"
    greet("Chidi")   -> "Hello, Chidi"

    Same steps, different inputs.
    

Mini summary

A function is a block of steps you can use again and again. It saves time and keeps programs organised.


Lesson 10 โ€” Input and Output

Definition

Input is information that goes into a program. Output is information that comes out of a program.

Why it is important

Without input, a program would have nothing to work with. Without output, a program would have nothing to show.

Simple explanation

Think of a calculator. You type numbers (input). The calculator shows the answer (output).

Real-life example

A bank web application: You enter your account number (input). It shows your balance (output).

School example

A result portal: You enter your exam number (input). It shows your results (output).

Home example

A calculator: You enter 2 + 3 (input). It shows 5 (output).

Nigerian example

A POS machine: You enter the amount (input). It prints a receipt (output).

Illustration

    INPUT AND OUTPUT
    ================

    [ Input ] --> [ Program ] --> [ Output ]

    Example:
    [ 2 + 3 ] --> [ Calculator ] --> [ 5 ]

    Another example:
    [ account number ] --> [ Bank app ] --> [ balance ]
    

Mini summary

Input is information going into a program. Output is information coming out. Every program uses both.


Lesson 11 โ€” Putting It All Together

Definition

Putting it all together means using variables, data types, lists, functions, and input/output in one program.

Why it is important

Real programs use all of these together. Understanding how they fit is the key to writing useful programs.

Simple explanation

Think of a small shop. It has shelves (variables), categories (data types), item lists (lists), routines (functions), and customers (input/output). All work together.

Example Program in Pseudocode

    START

      shoppingList = [ "Rice", "Beans", "Oil" ]

      FUNCTION printList(list)
        FOR each item in list
          print item
        END FOR
      END FUNCTION

      printList(shoppingList)

      name = "Amina"
      print "Hello, " + name

    END
        

Real-life example

A school portal uses variables for student name, a list for subjects, a function to calculate average, and input/output to show results.

School example

A school attendance app stores names in a list, uses a function to count present students, and outputs the total.

Home example

A shopping app stores items in a list, calculates the total, and shows the receipt.

Nigerian example

A POS machine stores items in a list, uses a function to add prices, and prints a receipt.

Illustration

    PUTTING IT ALL TOGETHER
    =======================

    [ Variables ]  ->  [ Data Types ]  ->  [ Lists ]
          |                 |                  |
          V                 V                  V
    [ Functions ]  ->  [ Input/Output ]  ->  [ Complete Program! ]
        

Mini summary

Real programs use variables, data types, lists, functions, and input/output together. Understanding how they fit is key.


Lesson 12 โ€” Becoming a Programmer

Definition

Becoming a programmer means using logic to solve problems with code. You have all the basics now.

Why it is important

Programming is a valuable skill. It lets you build apps, solve problems, and help others.

Simple explanation

Think of learning to ride a bicycle. First you learn balance. Then pedalling. Then steering. Once you know these, you can ride anywhere. Programming is the same.

Steps to Become a Programmer

  1. Learn to think in steps (Module 1).
  2. Learn decisions and loops (Module 2).
  3. Learn to store and use information (Module 3).
  4. Choose a programming language (like JavaScript).
  5. Practice with small projects.
  6. Learn HTML, CSS, and JavaScript for web development.
  7. Keep learning and building.

Real-life example

A person who learns to code can build a website, an app, or a game.

School example

A student who learns to code can build a class project website or a simple quiz app.

Home example

A young person can build a website for a family business and help it grow.

Nigerian example

Many Nigerians have learned to code and now work for companies around the world. You can do it too.

Illustration

    BECOMING A PROGRAMMER
    =====================

    [ Learn to think in steps ]
              |
              V
    [ Learn decisions and loops ]
              |
              V
    [ Learn variables and data ]
              |
              V
    [ Choose a language ]
              |
              V
    [ Build small projects ]
              |
              V
    [ Build bigger projects ]
              |
              V
    [ Celebrate! ๐ŸŽ‰ ]
        

Mini summary

Becoming a programmer means using logic to solve problems. You have all the basics now. Keep learning and building.

Summary of Main Lessons

You have now learned the core ideas of Module 3: variables, naming variables, data types, numbers, text, true/false, lists, using lists, functions, input/output, and how everything fits together.


5. Key Vocabulary

Word Simple Definition
Variable A named box that stores information.
Data type The kind of information stored in a variable.
Number A data type for counting and calculating.
Text (String) A data type for words and letters.
True/False A data type with only two values.
List (Array) A way to store many items in one variable.
Item One piece of information in a list.
Function A block of steps you can use again and again.
Input Information that goes into a program.
Output Information that comes out of a program.
Call Using a function by its name.
Parameter Information you give to a function.
Return Information a function gives back.
Value What is stored inside a variable.
Assign Putting a value into a variable.

Summary of Key Vocabulary

These words will help you understand how programs store and use information. Use them often so they become easy.


6. Important Concepts

Concept 1 โ€” Information Needs a Name

Variables give information a name so programs can find it later.

Concept 2 โ€” Information Has a Type

Numbers, text, and true/false are different. Programs handle them differently.

Concept 3 โ€” Lists Keep Things Together

Lists store many items in one place. They are perfect for going through items one by one.

Concept 4 โ€” Functions Save Time

Functions are reusable blocks of steps. Write once, use many times.

Concept 5 โ€” Programs Take Input and Give Output

Every useful program receives information and produces a result.

Summary of Important Concepts

These five concepts are the heart of Module 3. Read them again before moving on.


7. Step-by-step Explanations

Step-by-step: How to Use a Variable

  1. Choose a name. Use a clear word, like "score".
  2. Put a value inside. For example, score = 0.
  3. Use the variable. Add to it, print it, or check it.
  4. Change it if needed. score = score + 1.
  5. Read it when needed. print score.
    USING A VARIABLE
    ================

    score = 0
    score = score + 1
    score = score + 1
    print score

    Output: 2
    

Step-by-step: How to Use a List

  1. Create the list. Write items inside square brackets.
  2. Read an item. Use its position number.
  3. Add an item. Use "add" or "append".
  4. Remove an item. Use "remove".
  5. Loop through items. Use a for loop.
    USING A LIST
    ============

    fruits = [ "Mango", "Banana", "Orange" ]

    print fruits[0]     -> Mango
    print fruits[1]     -> Banana

    FOR each fruit in fruits
      print fruit
    END FOR
    

Step-by-step: How to Write a Function

  1. Choose a name. Use a clear word, like "greet".
  2. List the inputs. What does it need? For example, "name".
  3. Write the steps. What should it do?
  4. End the function. Use END FUNCTION.
  5. Call the function. Use its name and pass inputs.
    WRITING A FUNCTION
    ==================

    FUNCTION greet(name)
      print "Hello, " + name
    END FUNCTION

    greet("Amina")
    greet("Chidi")

    Output:
      Hello, Amina
      Hello, Chidi
    

Summary of Step-by-step Explanations

Using variables, lists, and functions all follow clear steps. Following steps makes it easy.


8. Real-life Examples

Example 1 โ€” A Shopping Cart

A shopping cart uses a list to store items. It uses a function to calculate the total. It uses input (the items you choose) and output (the receipt).

Example 2 โ€” A Bank Account

A bank uses variables to store your name and balance. It uses a function to add or subtract money.

Example 3 โ€” A Music Player

A music player stores songs in a list. It uses a function to play each song.

Example 4 โ€” A School Portal

A school portal stores student names in a list. It uses a function to calculate the average score.

Example 5 โ€” A Calculator

A calculator uses variables for numbers. It uses functions for addition and subtraction.

Summary of Real-life Examples

Variables, lists, and functions appear in shopping carts, banks, music players, school portals, and calculators.


9. Nigerian Examples

Example 1 โ€” POS Machine

A POS machine stores items in a list. It uses a function to calculate the total. It shows the receipt as output.

Example 2 โ€” Bank Transfer

A bank stores your balance in a variable. It uses a function to transfer money.

Example 3 โ€” School Result Portal

A school portal stores each student's name and scores. It uses a function to calculate the grade.

Example 4 โ€” Pure Water Seller

A pure water seller uses a variable to track bags sold. Each bag sold adds to the variable.

Example 5 โ€” Jumia and Konga

These online stores use variables for prices, lists for products, and functions for calculating totals.

Summary of Nigerian Examples

Nigeria has many examples of variables, lists, and functions in POS machines, banks, schools, and shops.


10. Fun Examples Children Can Relate To

Example 1 โ€” Video Game Score

A game stores your score in a variable. Every point adds to it.

Example 2 โ€” A Playlist

A music playlist is a list of songs. The app plays each one.

Example 3 โ€” A Pencil Case

A pencil case is like a list of items: pens, pencils, erasers.

Example 4 โ€” A Recipe

A recipe is like a function. You follow the same steps each time.

Example 5 โ€” A Sports Team

A team is a list of players. The coach uses a function to select the starting eleven.

Summary of Fun Examples

Variables, lists, and functions appear in video games, playlists, pencil cases, recipes, and sports teams.


11. Everyday Examples

Task Variable List Function
Shopping Total price Items to buy Calculate total
Cooking Number of servings Ingredients Cook rice
Charging phone Battery level Apps open Charge battery
Going to school Time left Subjects for the day Attend class
Sending a text Message length Contacts Send message

Summary of Everyday Examples

Even simple daily activities use variables, lists, and functions.


12. Parent Tips

  1. Point out variables in daily life. The score in a game, the price of an item.
  2. Show lists. The shopping list, the class register, the timetable.
  3. Explain functions. A recipe, a routine, a chore.
  4. Play with numbers. Ask your child to calculate the total cost of items.
  5. Encourage naming. Let your child name things clearly.
  6. Use simple games. "Let's make a list of things to buy."
  7. Praise good organisation. When your child organises things well, praise them.
  8. Be patient. Learning takes time.

Summary of Parent Tips

Parents can help children understand variables, lists, and functions through daily activities.


13. Interesting Facts

  1. The word "variable" comes from the Latin word "variabilis", meaning "changeable".
  2. Lists can hold millions of items.
  3. Functions can be reused thousands of times in one program.
  4. The most common data types in programming are numbers, text, and true/false.
  5. Some programming languages check data types automatically. Others do not.
  6. Input and output are the two-way conversation between users and programs.
  7. Even the simplest calculator uses variables and functions.
  8. In Nigeria, many coding schools start with variables, lists, and functions.

Summary of Interesting Facts

Variables, lists, and functions are powerful, common, and used everywhere.


14. Did You Know?

  • Did you know that every app you use stores information in variables?
  • Did you know that a list can grow or shrink as the program runs?
  • Did you know that functions make programs shorter and easier to fix?
  • Did you know that input can come from a keyboard, a file, or even another program?
  • Did you know that output can be text, images, sounds, or files?
  • Did you know that learning variables is the first step to learning any programming language?

Summary of Did You Know?

Variables, lists, functions, and input/output are the foundation of every program.


15. Remember This

  • A variable is a named box that stores information.
  • Good variable names are clear and short.
  • A data type tells the program what kind of information is stored.
  • The three main data types are numbers, text, and true/false.
  • A list stores many items in one variable.
  • Using a list means adding, removing, reading, and looping.
  • A function is a reusable block of steps.
  • Input is information going into a program.
  • Output is information coming out of a program.
  • Real programs use variables, lists, and functions together.

Summary of Remember This

These ten points are the heart of Module 3. Read them again before finishing the course.


16. Common Mistakes

  1. Using vague variable names. "x" and "a" are hard to understand.
  2. Mixing data types. Trying to add a number to text.
  3. Forgetting to put text in quotes. Text needs quotes: "Hello".
  4. Using the wrong position in a list. Most lists start at position 0.
  5. Forgetting to call a function. Defining it is not enough.
  6. Not handling input. Programs should check what the user enters.
  7. Making functions too long. Keep them short and clear.
  8. Giving up too soon. Practice is the key.

Summary of Common Mistakes

Avoiding these mistakes will make you a better programmer than many adults.


17. Best Practices

  1. Use clear variable names.
  2. Choose the right data type for the job.
  3. Keep lists organised.
  4. Use functions for repeated steps.
  5. Keep functions short and focused.
  6. Always validate input.
  7. Test your program with different inputs.
  8. Write pseudocode before real code.
  9. Comment your code so others understand.
  10. Practice every day.

Summary of Best Practices

These ten practices will help you write better programs.


18. ASCII Illustrations, Diagrams, Flowcharts, and Timelines

Diagram 1 โ€” Variables Are Like Labelled Jars

    VARIABLES ARE LIKE LABELLED JARS
    ================================

    [ Sugar ]   <- variable holding sugar
    [ Salt ]    <- variable holding salt
    [ Rice ]    <- variable holding rice
    

Diagram 2 โ€” Three Data Types

    THREE DATA TYPES
    ================

    Number:      age = 13
                 balance = 5000

    Text:        name = "Amina"
                 city = "Kano"

    True/False:  isRaining = true
                 isPassed = false
    

Diagram 3 โ€” A List

    A LIST IS LIKE A SHOPPING LIST
    ==============================

    shoppingList = [ "Rice", "Beans", "Oil", "Salt" ]

    Item 1: "Rice"
    Item 2: "Beans"
    Item 3: "Oil"
    Item 4: "Salt"
    

Diagram 4 โ€” A Function

    A FUNCTION IS LIKE A RECIPE
    ===========================

    FUNCTION greet(name)
      print "Hello, " + name
    END FUNCTION

    greet("Amina")   -> "Hello, Amina"
    greet("Chidi")   -> "Hello, Chidi"
    

Diagram 5 โ€” Input and Output

    INPUT AND OUTPUT
    ================

    [ Input ] --> [ Program ] --> [ Output ]

    Example:
    [ 2 + 3 ] --> [ Calculator ] --> [ 5 ]
    

Diagram 6 โ€” Putting It All Together

    PUTTING IT ALL TOGETHER
    =======================

    [ Variables ]  ->  [ Data Types ]  ->  [ Lists ]
          |                 |                  |
          V                 V                  V
    [ Functions ]  ->  [ Input/Output ]  ->  [ Complete Program! ]
    

Summary of Illustrations

These diagrams help you see how programs store and use information. Draw them yourself to remember them better.


19. Comparison Tables

Table 1 โ€” The Three Data Types

Number Text (String) True/False
For counting and calculating For words and letters For yes-or-no questions
Example: 5, 100, 3.14 Example: "Amina", "Hello" Example: true, false
Can be added Can be joined Can be checked

Table 2 โ€” Variable vs List

Variable List
Holds one item Holds many items
Example: name = "Amina" Example: fruits = ["Mango", "Banana"]
Simple More powerful

Table 3 โ€” Input vs Output

Input Output
Information going in Information coming out
From the user, keyboard, file To the screen, printer, file
Example: typing a name Example: showing a greeting

Summary of Comparison Tables

Comparing ideas side by side helps you remember the differences clearly.


20. Summary After Every Lesson (Consolidated)

Lesson Main Idea
Lesson 1 A variable is a named box that stores information.
Lesson 2 Good variable names are clear and short.
Lesson 3 A data type tells what kind of information is stored.
Lesson 4 Numbers are used for counting and calculating.
Lesson 5 Text is used for words and letters.
Lesson 6 True/False is used for yes-or-no questions.
Lesson 7 A list stores many items in one variable.
Lesson 8 Using a list means adding, removing, reading, and looping.
Lesson 9 A function is a reusable block of steps.
Lesson 10 Input goes into a program. Output comes out.
Lesson 11 Real programs use all these parts together.
Lesson 12 Anyone can become a programmer with practice.

21. End-of-Module Summary

Congratulations! You have completed Module 3. Let us review what you have learned.

You began by learning that a variable is a named box that stores information. You learned how to give variables good names.

You discovered data types โ€” the kind of information a variable holds. You learned about numbers, text, and true/false.

You explored lists โ€” ways to store many items in one variable. You learned how to add, remove, read, and loop through items.

You learned about functions โ€” reusable blocks of steps. Functions save time and keep programs organised.

You discovered input and output โ€” how programs receive and send information.

Finally, you learned how to put it all together and how to become a programmer.

    MODULE 3 SUMMARY MAP
    ====================

    [ Variables ] --> [ Data Types ] --> [ Lists ]
          |
          V
    [ Functions ] --> [ Input/Output ] --> [ Complete Program! ]
          |
          V
    [ You can now store and use information! ]
    

Well done! You have completed the entire Programming Logic for Web Developers course. You now have the logical foundation to learn any programming language.


22. Frequently Asked Questions (10 Questions)

Question 1: What is a variable in the simplest words?

A variable is a named box that stores information in a program.

Question 2: Why do variable names matter?

Clear names make programs easy to read and understand. Bad names cause confusion.

Question 3: What is a data type?

A data type tells the program what kind of information is stored โ€” a number, text, or true/false.

Question 4: What are the three main data types?

Numbers, text (strings), and true/false.

Question 5: What is a list?

A list stores many items in one variable. Each item can be used separately.

Question 6: What is a function?

A function is a reusable block of steps. You write it once and call it whenever needed.

Question 7: What is input?

Input is information going into a program, like typing your name.

Question 8: What is output?

Output is information coming out of a program, like showing your greeting on the screen.

Question 9: Can I use variables, lists, and functions in real life?

Yes! You already use them for shopping lists, recipes, and routines.

Question 10: What should I learn next?

After this course, you can learn HTML, CSS, and JavaScript for web development.


23. Matching Exercises

Exercise 1 โ€” Match the Word to the Meaning

Column A (Word) Column B (Meaning)
1. Variable A. A reusable block of steps
2. Data type B. A named box that stores information
3. List C. Information going into a program
4. Function D. A way to store many items
5. Input E. The kind of information stored

Answers: 1-B, 2-E, 3-D, 4-A, 5-C

Exercise 2 โ€” Match the Example to Its Type

Column A (Example) Column B (Type)
1. age = 13 A. Text
2. name = "Amina" B. True/False
3. isRaining = true C. Number
4. fruits = ["Mango", "Banana"] D. List

Answers: 1-C, 2-A, 3-B, 4-D

Summary of Matching Exercises

Matching helps you connect words to meanings quickly.


24. Scenario-based Exercises

Scenario 1 โ€” The Lost Score

A game developer forgets to store the score in a variable. Every time the game restarts, the score is lost.

Questions:

  1. What is missing?
  2. What should the developer do?
  3. Write pseudocode for storing the score.

Scenario 2 โ€” The Confused Shopping Cart

An online shop stores each item in a separate variable. After 50 items, the developer gets confused.

Questions:

  1. What is the problem?
  2. What should the developer use instead?
  3. How would a list help?

Scenario 3 โ€” The Repeated Code

A developer writes the same 10 lines of code 20 times in a program. The program is very long and hard to fix.

Questions:

  1. What should the developer use?
  2. How does this help?
  3. What is the name of this feature?

Summary of Scenario-based Exercises

These scenarios help you apply what you have learned to real situations.


25. Group Activity

Activity: Plan a Simple Shopping Program

Group size: 3โ€“5 students

Time: 40 minutes

Materials: Paper, pencil, ruler

Instructions:

  1. Imagine a small shop that sells 5 items.
  2. Create variables for the shop name and total sales.
  3. Create a list of items and their prices.
  4. Write a function to calculate the total price of an order.
  5. Write a loop that shows all items.
  6. Present your program to the class.

Goal: To practise using variables, lists, and functions together.


26. Individual Activity

Activity: My Personal Variables

Time: 20 minutes

Materials: Notebook, pencil

Instructions:

  1. Write 5 variables that describe you (e.g., myName, myAge).
  2. Write what data type each variable is.
  3. Write one list of your favourite foods.
  4. Write one function that takes your name and prints a greeting.
  5. Write the input and output of your function.

Goal: To connect variables, lists, and functions to your own life.


27. Mini Project

Project: Design a Simple Grade Calculator on Paper

Time: 1โ€“2 hours

Materials: Paper, pencil, ruler

Instructions:

  1. Create a list of 5 subjects.
  2. Create a variable for each score.
  3. Write a function to calculate the average score.
  4. Use an if/else to decide the grade (A, B, C, D, F).
  5. Print the results as output.
  6. Draw a flowchart of your program.
  7. Present it to the class.

Goal: To combine variables, lists, functions, decisions, and loops.


28. Practical Assignment

Assignment: Observe Information Storage in Daily Life

Time: 1 week

Materials: Notebook, pencil

Instructions:

  1. For one week, look for examples of variables, lists, and functions in daily life.
  2. Write down at least 5 examples of each.
  3. For one example, write pseudocode using variables and a list.
  4. For one example, write pseudocode for a function.
  5. Write a short report on what you learned.

Goal: To see how programs store and use information, just like real life.


29. Key Takeaways

  1. A variable is a named box that stores information.
  2. Good variable names are clear and short.
  3. A data type tells what kind of information is stored.
  4. The three main data types are numbers, text, and true/false.
  5. A list stores many items in one variable.
  6. Using a list means adding, removing, reading, and looping.
  7. A function is a reusable block of steps.
  8. Input is information going into a program.
  9. Output is information coming out of a program.
  10. Real programs use all these parts together.

30. Classroom Discussion Questions

  1. Why do programs need variables?
  2. Can you give an example of a variable from your daily life?
  3. Why do you think data types matter?
  4. What is the difference between a variable and a list?
  5. Can you think of a list from your daily life?
  6. Why do you think functions are useful?
  7. What is the difference between input and output?
  8. Can you give an example of input and output from a bank app?
  9. Why do you think programs need both input and output?
  10. What did you enjoy most in this module?

31. Course Completion & Next Steps

You have completed the entire Programming Logic for Web Developers course. Well done! Here is what to do next.

  1. Review all modules. Go back through Module 1, 2, and 3. Make sure you can explain every key idea in your own words.
  2. Finish your final project. Complete the design you started in this module.
  3. Start learning HTML. Free resources like W3Schools can help you begin.
  4. Practice logic daily. Write pseudocode for simple tasks.
  5. Learn a real language. JavaScript is a great next step for web development.
  6. Build small projects. A to-do list, a simple calculator, or a quiz.
  7. Keep learning. Programming is a journey. Enjoy it.
    YOUR COURSE JOURNEY
    ===================

    [ Module 1: Thinking in Steps ]
              |
              V
    [ Module 2: Making Decisions and Repeating Tasks ]
              |
              V
    [ Module 3: Storing and Using Information ]
              |
              V
    [ You can now think like a programmer! ] ๐ŸŽ‰

    Next step: Learn HTML, CSS, and JavaScript.
    

Congratulations on completing the course. Keep thinking, keep practising, and one day you will build something amazing.


๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, pass the exam, and unlock Practice Tools plus a verified certificate with your name on it โ€” โ‚ฆ4,000/month.

๐ŸŽ“ Sign Up & Unlock for โ‚ฆ4,000/month
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - try them free for 7 days, no card required.
โ†’