Introduction

Computer programs are instructions telling the computer how to process input and deliver output. An important part of programming is telling the computer WHEN to perform a certain task. For this, we use something called ‘conditionals’. Conditionals get their name because a certain Condition or Rule has to be met.

Students are all already familiar with the concept of conditionals in their daily lives!

Have they ever had their parents say..?

  • “If you clean your room, you can go out with your friends.”
  • “If your homework is done, you can play video games.”
  • “If you do your chores all week, you get your allowance, else you are grounded.”

These are all conditionals! Conditionals follow the format of IF this, THEN that.

IF (condition is met), THEN (action performed)

Have the students share a few conditionals from their own lives with the class or within small groups.

Note: For older students, you can have them add the ELSE portion of a conditional.

IF (condition is met), THEN (action performed), ELSE (different action performed)

Example:

  • IF it is snowing, THEN wear boots, ELSE wear shoes.

The ELSE portion makes sure that a different action is performed in either case. Without the ELSE action, your students might be barefoot!

If-Then workflow

Tell the students that they will be acting out some conditionals as though the whole class is a computer program for a game. Each student will perform a described action if the indicated condition is met.

Note: This activity can be done as a whole class or in smaller groups or as a pencil and paper activity.