Every program we’ve seen so far has only had one possible path of execution — they all execute line by line, from top to bottom. And every time you run one of those programs, it gives you the same exact result. But it’s the twenty-first century, and we like options!

In this lesson, we will introduce logic into our code and explore how programs make decisions by evaluating conditions!

We’ll be covering the following concepts:

  • if, else if, and else statements
  • switch statements
  • Relational and Logical operators
  • Ternary operators

So… if you’ve already learned these concepts in another language, go to the next lesson — else, prepare yourself and let’s get started!


Move on when you’re ready!

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?