What are Conditional Statements?

Learn about conditional statement, If... then... statements in coding.

Jon Mattingly avatar
Written by Jon Mattingly
Updated over a week ago

As programmers, we are in control of every action a computer carries out. Once a computer is given commands in the correct sequence, we can add another element to our code that will alter the computer program’s path: Conditions. Students are introduced to conditions in planet Smeeborg.


Conditions are basic “if, then” logic statements that modify how code is executed. Conditions are a key part of the decision-making process for computers.

Example: Conditional statements are part of our everyday lives. As people, we can think about situations and make decisions based on what we observe or know to be true. For example, “If it is raining out, then we will have recess inside.” Or “If it is my birthday, then I can have a birthday cake.” Conditions are cause and effect: “If this, then that.”

Programming Application: Since computers are machines that can’t do anything without us directing them, we direct the computer using conditional statements. This tells the computer what to do and when to do it.

In programming, a great example of a condition is a password. Passwords are “if, then” logic statements: If a user enters the correct password, then they can access the program.

In Kodable, students will use colored tiles as conditions to alter the path of their fuzz: for example, “If the tile is pink, then go down.

Why We Use Conditions: Conditions allow us to control what the program does and perform different actions based on these “if, then” logic statements. What makes computer programs great is the ability to interact with a user- this is only possible with conditions that direct this type of interaction.

Did this answer your question?