- Explain what an if statement is and why it's used
- Implement an if statement with 1, 2, and 3+ branches
- Implement the comparison operator
If statements are like traffic intersections in your code. They allow you to have different paths the program can take depending on what happens as it is executed. Different pieces of code get executed depending on what the user submits, a computation's result, or a value that gets returned somewhere else in the program. Each path is called a branch, and control flow describes the use of branches within our code.
The if statement will be your main control flow tool you'll use in your code. There are other types of statements you can use for control flow like unless statements or case statements, too.
View Students Will Be Able To... on Learn.co and start learning to code for free.