Teaching conditionals


How do you teach the core computer concept of conditionals to your students?

Share your best practices, hacks, tips and tricks here. Also feel free to share here your questions, half-baked ideas, spectacular failures and concerns about teaching loops.

In your post, be sure to tell us what grade you teach and any other relevant information about your classroom context that will help other understand how they might implement your idea.


Here are some code.org Code Studio resources that cover conditionals:

Unplugged Lesson Plans

Review “Conditionals with Cards” Lesson Plan: Course 2

Code Studio Activities

Explore Course 2 conditionals stages:


I found Stage 12 Puzzle 1 offered after the conditionals video a tad confusing for many of my students. I had to take a step backwards when teaching this concept and use simpler activities before jumping to that puzzle. We started with cards, but used a much easier If statement example of just read and black. My students then came up with a bunch of different examples of games and we played them. As my students began to catch on we took them to the next level and used nested loops in those same games. This was a little more confusing for them, but they eventually came to understand the hows and whys behind nested loops. I definitely recommend spending extra time on If Statements off the computer. I give at least a full 45 minute period to this concept before even attempting to get on the computer.


I might try to connect conditionals to board games or familiar video games and have students work in small groups to create a set of if…else statements to summarize some of the features in these games. Connecting this to chess might be interesting to see how students bring this type of thinking into determining their next move.


K-5 students can come up with some pretty entertaining responses when invited to share “if-else” situations. Their Studio Code experience becomes even more empowering when they realize that the computer can follow not only their directions but also respond to their specific preferences.

The best thing is when they earn an early dismissal or some other reward like free-time on the computer, but choose to stay on the more academic CODE.org while discovering that "Learning is FUN!



I can see how this might be confusing, especially to my second graders. I do think I would spend more time playing the initial game with cards using the if/else statement (red/black).


One thing I have noticed in this activity is that students (and teachers!) tend to zoom to nested loops and making conditionals very complicated.

I would definitely play this game for a while in my classroom, perhaps using it as part of a math center and creating different if/else rules for play for simplified games before getting into nested loops.


I might introduce 1st - 3rd grade students to conditionals by giving partners pictures of umbrellas and sunglasses, and pictures of sun and thunder clouds. Other groups get pictures of sun and swimsuits, thunder clouds and a video game on a computer screen. Each groups also gets IF written on a card, also a card with THEN. Partners write their own conditional statements and share with the class.


I have never taught conditionals but I like the examples that are provided. I’m sure my students could come up with some fun games with this concept!


Come back and tell us what your students come up with!


Wow - my college freshmen don’t get if…else in Excel. And, unfortunately, I think that it makes sense so I don’t always know the best way to explain it. I think I will try my Duplo track again. If the old lady (yep, there is a grey-haired Duplo lady) is on the train, get off at the Y else keep going around the circle. I’ll see how well that works.


I explained conditionals in using every day life.

Also, if you do your chores, you get an allowance.
If you do not do your chores, you will not get an allowance.


A take on Simple Simon Says: If you are wearing orange, take a hop forward, else take a step back. If you are 6 years old, take a scissor step forward, else stand on one foot, etc.


I teach 7th and 8th graders. I teach conditionals by using the example of “waking up to the alarm,” If it’s Sat or Sun, turn alarm off and go back to sleep. If it’s Mon - Fri, jump up out of bed (or hit snooze! lol!).

I also go back to the washing dishes (mentioned in my loops). If there’s glasses, wash glass. Then, if there’s knives, wash knife. etc Again, using things that’s common to everyday life.


Sticking with the Minecraft theme in my answers…

I could see teaching students about conditionals using the crop growing mechanics within the game.

If the wheat is completely grown, harvest it, else let it continue to grow.


To teach conditional statements, I would have students all line up in a row and have them perform tasks based on what they are wearing. For example if you are wearing red, write your name on the board. Students can visualize the task and have a better connection before writing the code.


We discuss situations in our lives when conditionals apply. the weather example always comes up, as well as other situations which are common in the lives of little ones:
When I lose a tooth, the tooth fairy comes.
many teachers control the movement in their room with conditionals: If you are wearing blue shoes, you may get your lunchbox and line up. If you have put your math materials away, you may read silently.
When I am mean to my sister, I have to sit in time out.
When it is Tuesday, I go to soccer.
I really like the idea of the Conditionals with Cards game. I will definitely try that.


I think my adult students are used to conditionals since they must make decisions based on them everyday. If school is letting out early or cancelled, I need to find a sitter. If my car breaks down, I need to find another way to class or work. I would have my students think of other examples of conditionals in their every day life.


For 7th and 8th graders, I pick 3-4 volunteers. They will walk outside and on counts of 20 between students, one of them will walk in the door. They will then walk out and the next student will come in. The students who are outside get to randomly pick who is next to walk in the door.
The students in the class must do what is decided for each student. For example, if Anna enters the room we all stand and say Hazzah!, else we stay seated and go OHHH. As a class, students decide what the if, else results will be for each of the volunteers. Do have an if, else in case an administrator walks in the room wondering what’s going on.


I would use conditionals to introduce the “if” statements in coding.