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.


If you’re ready, click Next.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?