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

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


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 in this unit:

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