๐Ÿค” Lesson 3: Teaching Computers to Choose

Learn how computers make decisions using IF and ELSE!

What are Conditionals?

Conditionals help computers make choices. They ask questions and do different things based on the answers - just like you do every day!

๐Ÿšฆ Making Decisions Every Day

You already use conditionals in real life:

๐ŸŒค๏ธ Real Life Example: Getting Dressed

IF it's raining, THEN take an umbrella.

IF it's cold, THEN wear a jacket.

ELSE (if it's not cold), wear a t-shirt!

๐Ÿ’ป How Computers Write It

if (weather === "rainy") {
  bringUmbrella();
} else {
  enjoyTheSun();
}

๐ŸŽฎ Try It: Weather Decision Maker

Click on the weather to see what the computer decides:

โ˜€๏ธ Sunny
๐ŸŒง๏ธ Rainy
โ„๏ธ Snowy
๐Ÿ’จ Windy
Click a weather option to see the computer's decision!

๐Ÿ“š Key Words to Remember