This page provides information to support educators and families in teaching K-3 students about conditional statements and booleans. It is designed to complement the Conditionals topic on BrainPOP Jr.

Learning to code develops children’s critical thinking and problem-solving skills, while empowering them to be creative and to persevere. It’s also fun!  

Review with students that a boolean is a kind of data that tells a computer what to do by giving two possible values—true or false. They can think of a boolean as an answer to a yes/no question. Model a boolean by asking a question about something you are doing, like clapping your hands. By answering yes, a child is recognizing a true value. If you are not clapping your hands, the value would be false.  

Explain to children that in block-based coding, boolean blocks identify the actions we want to code, such as “hands clapping.” We then set a value of the boolean block to true or false. So if you want to check if a character or sprite is clapping, you’d type “true” in the boolean. Point out that you can also combine two or more actions, like clapping and jumping, by adding an “and” block between the two action blocks and set both values as true.

To check for something that is NOT happening, we add a “not” block before the action and set the boolean value to true or false. So, if we want to check if the character is NOT clapping their hands, we’d place a “not” block before “clap hands” and set it to true.

Point out that a conditional statement uses booleans to tell a computer to do one action or another depending on whether a boolean is true or false. Again, provide an offline example, such, “If I clap my hands, then you clap your hands.” Now clap your hands. When students clap their hands, reinforce what is happening: I am clapping my hands so the value is “true” and therefore you are clapping your hands. Explain that if you were NOT clapping your hands, the value would be false, and they would NOT clap their hands.  

Explain that a conditional statement can also tell you to do one thing if a value is true, and something else if it’s false. Give an example, such as “If I clap my hands two times, then you line up at the door. Or else, you push in your chairs.” Try it out. First, clap your hands two times. Children should respond by lining up at the door. Then have them return to their seats. When everyone is seated, snap your fingers. Children should respond by pushing in their chairs. Point out that they first identified an a statement as true or false and responded according: If true, they lined up. If false, they pushed in their chairs.

Follow up by writing the code for the conditional statement. Remind students that on the computer, these words appear in blocks that they drag into a coding editor, or workspace as follows:

If [clap hands two times = true] then

[line up at door]

else

[push in chairs]

Coding is no longer a skill exclusive to high-tech programmers, but one that is quickly becoming integral to many industries—from medicine to transportation and more. As a result, learning to code is becoming as fundamental as reading, writing, and math. Coding is empowering for children, too,  as they learn to solve problems independently and think creatively in the process.

Filed as:  Conditionals