Unplugged Lesson
Beginner
45 mins
Teacher/Student led
+50 XP
What you need:
IWB/Projector/Large Screen

If/Then (Old MacDonald had a Farm)

In this lesson, you'll explore conditional logic using the structure of a familiar song. Learn how IF/THEN rules work by connecting items to actions, and create your own fun rules with classmates using school objects.
Learning Goals Learning Outcomes Teacher Notes

Teacher Class Feed

Load previous activity

    1 - Introduction

    In this lesson, you'll teach your students about Conditional Logicโ€”the IF/THEN rules that help us make decisions.

    We'll use the structure of the "Old MacDonald Had a Farm" song to show how an item (the IF) can prompt a specific action (the THEN).

    By the end, the class will collaborate to write their own custom rules using school items, translating simple observations into a fun, logical program they can perform together.

    Materials Needed:

    • Old MacDonald Cut and Paste Worksheet
    • Scissors and Glue

    2 - Old MacDonald Had a Farm

    Begin the lesson by singing "Old MacDonald Had a Farm".

    Ask the students questions about the song such as "Do you know this song?, What kind of animals normally appear in this song? What sounds do they make?"

    You can go through this song 2 or 3 times if any children are unfamiliar!

    Check teacher notes for some fun extensions that you can do with your class.

    3 - Establish the Rule

    Tell the students that the "Old MacDonald" song is secretly built on a very simple computer rule.

    The rule has two parts:

    1. First, sing the verse of the song until you name the animal, like a Cow. Explain to the class that the animal is the magic word, the trigger that starts the action. In code, we call the trigger the IF part. So, the rule starts: "IF I say 'Cow'."
    2. Second, when the class makes the animal sound, point out that the Cow has now forced them to make the Moo sound. This action that must happen is the THEN part of the code.

    Put your hands together and say the complete rule clearly: IF the Cow is said, THEN you must Moo!

    This is one of the most important rules a computer knows. We are making the same type of decisions with this song, just like a robot.

    4 - Old MacDonald had a Train

    Tell the students that you are now writing a new song for Old MacDonaldโ€”he is trading his farm animals for modes of transport!

    Remind them that the rule is the same: the transport is the IF, and the sound is the THEN.

    Use the flip chart below to present the new Conditions (images of transport, one at a time).

    As you flip to each image (Train, Car, Boat, Airplane, etc.), ask the students: "If Old MacDonald had a Train, what noise would it make?"

    Agree on a new noise for each mode of transport in the flipchart (for example, bus = beep beep, train = choo choo, etc.).

    Lead the class in a quick test. You call out the transport (the IF), and the whole class executes the new, agreed-upon noise and possible movement (the THEN).

    5 - Individual Coding—The Cut and Paste Activity

    Give each student a sheet that has several images of transport (cars, trains, boats, trucks, bikes, etc.).

    Instruct the students to choose four different transport pictures they want in their own personal song. They will cut these images out.

    For each picture they chose, they must glue it onto their worksheet and then create the unique noise that transport will make in their custom code. Encourage them to be creative with the sounds!

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of DigitalSkills.org 2017 - 2025. Unauthorised use, copying or distribution is not allowed.
    ๐Ÿช Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more