Decisions, decisions. Conditionals are how we do something, or something else.

In this unit I’ll introduce you to conditionals.

Through the use of conditionals we can tell our program “do this, or do that” depending on some condition.

The first thing I’ll introduce is how to create those conditions, using comparison operators.

Then we’ll see how to use:

  • if
  • else
  • switch

and the ternary operator.

Lessons this unit:

0: ▶︎ Introduction
1: Comparison operators
2: `if` statements
3: How to use `else`
4: `switch`
5: The ternary operator