In life, we make decisions based on circumstances. Think of an everyday decision as mundane as falling asleep — if we are tired, we go to bed, otherwise, we wake up and start our day.
These if-else decisions can be modeled in code by creating conditional statements. A conditional statement checks a specific condition(s) and performs a task based on the condition(s).
In this lesson, we will explore how programs make decisions by evaluating conditions and introduce logic into our code!
We’ll be covering the following concepts:
else if, and
- comparison operators
- logical operators
- truthy vs falsy values
- ternary operators
So if you’re ready to learn these concepts go to the next lesson— else, read over the concepts, observe the diagram, and prepare yourself for this lesson!
Check out the diagram to see how conditionals allow us to create decision-making technology.