Learn
We make decisions in everyday life based on conditions.
If weβre tired, we might take a rest. If weβre thirsty, we would find something to drink. If weβre hungry, we grab something to eat. And if we want to be one with emojis π§ββοΈ, we learn Emojicode.
We can mimic the same type of decision making in our code using conditionals. Conditionals take an expression, which is code that evaluates to determine a value, and checks if it is π
or π
.
If itβs π
, we can tell our program to do one thing β we can even account for π
to do another.
As we write more complex programs, conditionals allow us to address multiple scenarios and make our programs more robust.
Instructions
If youβre ready, click Next.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.