What are Conditionals?
Conditionals are if-then statements that tell a program what to do in different situations. They help students build flexible, decision-based code:
“If this happens, then do that.”
Think of it like this: If it’s raining, then we stay inside for recess. That decision depends on a condition. In coding, we use conditionals to let programs respond to changes in the game or environment.
Where Students Use Conditionals in Kodable
Conditionals in Kodable Basics
Students are introduced to conditionals in the Smeeborg course. They use colored tiles as the conditions to change how their Fuzz moves through the maze.
When they encounter a tile, they can:
Check for a specific color
Trigger a different command based on the color
Reach stars and the goal more efficiently
Example:
In the maze below, the code reads: “If the tile is green, then turn left.” This helps the Fuzz turn at just the right moment to collect two stars before reaching the end of the maze.
Conditionals in Kodable Creator
Students explore more advanced conditionals in the course—Key Quest. Here, they use true/false logic to decide what happens in their game.
Students can:
Check if something is true (like having a key)
Choose between two outcomes
Add variety to how the game reacts
Example:
In the game, a student might write: “If the player has a key, open the door. If not, show a message.” These choices help students make more interactive, responsive games.
Why It Matters
Conditionals help students:
Build smarter, more responsive code
Practice logic and decision-making
Understand how real programs make choices
From guiding a Fuzz to unlocking doors, conditionals give students more control over what their code can do.