Sometimes our code needs to take different paths depending on the situation. Having our program respond to different conditions requires a new tool, if statements.

Throughout this lesson, we will discuss different types of conditions, as well as different types of if statements. There are three types of conditions used in if statements:

  • Equality
  • Relational
  • Logical

These conditions are used to define different types of if statements. Types of if statements include:

  • If
  • Else
  • Else if

In the next exercise, we will take a look at basic if and else statements. First, let’s see the limitations of code without conditionals.


Place code inside of the loop to help Codey reach the goal. We can use code like this to perform simple movement, but what do we do if we want something more complicated?

While program is running Move right

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?