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:
These conditions are used to define different types of if statements. Types of if statements include:
- 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