Choosing with if
Run code only when something is true.
Choosing with if is a free Coding for Kids lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Making a Choice 🤔
Hello, decision maker! 🧠 Sometimes code needs to choose what to do. Like: IF it is raining, take an umbrella! ☔
The if Word 🪧
In Python we use the word if to make a choice. If something is true, the code inside runs!
age = 10
if age > 5:
print("You are a big kid!")The Colon and Indent ➡️
After if we put a colon : and then push the next line in with spaces (an indent). That space says "this belongs to the if". 📏
sunny = True
if sunny:
print("Lets play outside! ☀️")True or False 🎲
The if checks if something is True or False. Only True makes the inside run!
hungry = True
if hungry:
print("Time for a snack! 🍎")When It Is False 🚫
If the check is False, the inside is skipped. Nothing happens! Watch:
raining = False
if raining:
print("Bring umbrella!")
print("Done checking.")Comparing Numbers 🔢
We can compare numbers with > (bigger than). If true, the code runs!
score = 100
if score > 50:
print("You win! 🏆")Checking Equal == 🟰
To check if two things are the same, we use == (two equal signs).
color = "red"
if color == "red":
print("Stop! 🛑")A Secret Password 🔐
Let us check a password! If it matches, we open the door. 🚪
password = "magic"
if password == "magic":
print("Door opens! ✨")More Than One Line 📜
You can put many lines inside an if. They all need the same indent!
star = True
if star:
print("You are a star! ⭐")
print("Keep shining! 🌟")Using input() with if 🗣️
Ask a question, then choose what to do with the answer!
pet = input("Do you like cats? (yes/no) ")
if pet == "yes":
print("Cats are purrfect! 🐱")You Made a Choice! 🎉
Amazing! Try checking if a number is bigger than 10.
number = 15
if number > 10:
print("Big number! 🔢")Quick Check 🧠
Choice time! 🎯 What runs the code inside an if?
Recap Time! 🌟
Brilliant! 🎓 Today you learned:
ifmakes a choice- Use a colon
:and an indent - Code runs only when the check is True
==checks if things are equal
You are a choosing champion! 🏆
Frequently asked questions
Is the “Choosing with if” lesson free?
Yes — the full text of “Choosing with if” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.
What will I learn in “Choosing with if”?
Run code only when something is true. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Coding for Kids?
No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Choosing with if” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Coding for Kids lesson?
Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Choosing with if
- The else Backup Plan
- Comparing Values
- More Options with elif