Reference lesson

Conditions

Choose behavior with if, else, and switch.

About 8 minutes

What you’ll learn

Conditional statements run code only when an expression is truthy. Keep each branch focused and easy to understand.

Try it yourself

Press Ctrl/Cmd + Enter to run.