When scientists do experiments, they are always asking questions and wondering, “If I do this, then what will happen?” If/Then is an important part of coding. If/Then is what’s called a conditional statement in programming. The program queries if one condition exists, and then it commands it to do something. It can be as basic as a True or False question and answer or it can prompt an action.
Explore the If/Then concept with these fun games!
Backyard Coding Game
This game is sort of like Simon Says. For every round, there is one Programmer and everyone else is a Computer. The Programmer stands in front of the Computers and gives them a command. If I ____ (fill in the blank), then you _____ (fill in the blank). For example, the Programmer can give the command “If I turn stand on one foot, Then you stand on one foot.” Or, “If I stomp my foot, Then you do a jumping jack.” You can set up your rounds however works best for your group of kids. Kids love giving commands, so they will enjoy taking turns as a Programmer.
Coding with a Deck of Cards
Coding involves giving instructions to a computer to make something happen. In this activity, you can practice giving instructions to a toy to navigate through a card maze. This activity can be adapted for different age levels.
Setup:
First, create a grid with the deck of cards. Use some tape to hold them in place if you wish. Then, place a few toys as obstacles in the grid to create a sort of maze. Determine the Start and Finish line of the maze. Choose another toy, such as a robot or car, to move through the maze.
To Play (Beginner):
- One player gives ‘coding instructions’ one at a time to direct the robot to the finish line. For example: “Move forward 3 cards” or “Turn.”
- Another player follows the instructions and moves the robot until it reaches the finish line.
- It’s fun to switch roles!
To Play (Advanced):
- Kids need to think ahead and problem-solve by writing all the steps to get the robot from Start to Finish before moving the robot.
- Then another player follows the code to move the robot. If there is a mistake, the first player will need to ‘debug’ the code.