Please enable JavaScript to use CodeHS

Chapter 2

Conditionals

2.2 If Statements

If Statements

If/Else Statements

If/Else Statement

Check Your Understanding

  1. Invalid Answer

Exercise: Is It Snowing?

Vocabulary

Term Definition
If Statement An if statement lets you ask a question to the program and only run code if the answer is true.