IF you want to teach conditions in coding to kids, THEN read this

Posted on May 3, 2021

Conditions (also called conditionals or conditional statements) are one of the fundamental building blocks of coding and exist in every coding language. They are super-duper important because they give the computer the information it needs to make a decision.

Remember, computers don’t really have much personality (no offense), and they can’t think for themselves. So they need you and your students, the coding extraordinaries, to guide them in the right direction.

Listen to the whole Coding Songs album here!

Coding is about so much more than telling a computer what to do. It’s about creative problem solving, teamwork, and exploring new perspectives. Conditions are one of those coding basics that challenge us to think differently. The best bit? You already use conditions every single day.

What are conditions in coding?

Thinking like a programmer and learning computer science with kids means approaching problems logically. That’s precisely what conditions help us do. Conditions in programming are things that decide. These essential pieces of code check whether something is true or false before moving on to the next step.

Generally, conditionals use if/then statements. For example, IF the password is correct, THEN give the user access to the account. IF the user completes the puzzle within 20 seconds, THEN give them 100 coins. IF the user clicks the delete button, THEN send the email to the trash.

Conditional statements in real life

Programming can sometimes feel a little abstract. When teaching coding for kids, it helps to connect each computer science lesson to real-life examples. And with conditions, it’s easy! Why? Because we make a LOT of decisions as we move about our day.

An every day example of using a condition

We use conditions to make everyday choices.

We use conditions to decide one way or another – here are a couple of examples to illustrate:

  • You’ve just finished your dinner. IF you are still hungry, THEN you will sneak back into the kitchen for a second helping.
  • You’re at the beach. IF the water is warm and calm, THEN you will go for a swim.
  • Your alarm just went off. IF you want to push your morning routine to the very last minute, THEN you will hit snooze and go back to sleep.

You even decided to read this article. What were the conditions involved in your decision-making?

Conditions in programming for kids

Conditions are not a new concept – at least, not in day-to-day life. But teaching kids to think like coders means bridging the gap between theory and practice. How do conditions operate in code? Well, they typically check if something is true or equal to something else and use an IF part and a THEN part (and, in some cases, an ELSE part) to determine the next step, action, or inaction.

Here is a relatively simple example of how conditions work in code.

Imagine you are filling out an online form. It asks you for your email address. You type it in and click submit. But then an error message appears: ‘Invalid email address. Please try again.’ You look back at the email you entered, only to realize you typed a 2 instead of an @. It happens to the best of us. In this situation, the computer used a condition – IF the email address does not contain an @ character, THEN print ‘Invalid email address. Please try again.’

Conditions example in a coded basketball game

If you are coding a game, you can use conditions to tell the computer when to add points.

Conditions are also used to calculate scoring in computer games. We take a good look at how this might work in a basic shooting hoops game in our conditions video.

Join our coding bootcamp!

Coding helps us become creative thinkers. If you are teaching programming to kids, jump in and watch our Camp Coding Camp videos. We cover all the coding basics – including conditional statements. IF you want to have fun and learn about coding, THEN watch our videos!

Hey there!

Did you know that Scratch Garden has a 2nd Channel? With a growing library of more than 50 videos?

It's all true! We have created a whole other channel on Patreon! Patreon allows creators like Scratch Garden to offer a kind of membership for special fans like you. In exchange for your support, you can access monthly patron-only content like behind-the-scenes videos, Halloween and holiday videos, as well as many hilarious Blooper Videos

For as little as $2/month you can watch all these videos AND help support Scratch Garden to keep making great fun educational content. 

Check out our 2nd Channel to find out more!


1 Comment

  1. Lakshay Bansal
    May 24, 2023

    Informative Blog related to the coding for the kids. Applying conditions has always been a task for me.


Leave a Reply