In this lesson, you'll teach your students about Conditional Logicβthe powerful IF/THEN rules that make computers smart.
We'll use the familiar structure of the "Old MacDonald Had a Farm" song to show that an item (the IF) always forces 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.
Explain to the class that today, the robot learns to make decisions based on rules.
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!
Tell the students that the "Old MacDonald" song is secretly built on a very simple computer rule that they must follow exactly.
The rule has two parts:
Put your hands together and say the complete rule clearly: IF the Cow is said, THEN you must Moo!
This is the most basic rule a computer knows. We are making their brains follow the rule perfectly, just like a robot.
Now, tell the students you are going to write a brand new, secret code based on the new song: "Mrs. Mooney Had a Class" (or your teacher name/principal's name etc.). This time, the items in the classroom will be the Conditions that tell them to perform a movement and a sound instead of an animal noise.
Ask the students to help you fill out the code table. For each object, we will choose a body percussion action and a word that makes sense for that object.
For example:
| IF (The Condition) | THEN (The Action) |
| Crayon | Make a colouring motion with your arm + say "Colour!" |
| Lunchbox | Make an eating motion (hand to mouth) + say "Yum!" |
| Library Book | Make a small thumb-flicking motion (like turning a page) + whisper "Flick!" |
| Scissors | Make your hands open and close quickly (a cutting motion) + say "Snip!" |
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).