If/Then Choice Builder

Programs make decisions all the time. Build your own IF/THEN/ELSE rules, toggle conditions, and watch what happens. Every app you use runs thousands of these checks every second.

Watch how IF/THEN/ELSE works!

IFit is raining
THEN🧥 wear a raincoat← active
ELSE👕 wear a t-shirt
😊
🧥Wear a raincoat

The condition "It is raining" is TRUE — wear a raincoat!

Computer Logic Reference

What is a Condition?

A condition is a question that has exactly two answers: true or false. There is no "maybe."

  • "It is raining" is either true or false right now
  • "The light is red" is true or false
  • Conditions let computers make choices automatically
  • Programmers call true/false values booleans

IF/THEN/ELSE

Every IF/THEN/ELSE rule has two paths:

  • IF the condition is true, follow the THEN path
  • ELSE (if the condition is false), follow the ELSE path
  • Only one path runs — never both
  • This is called a conditional statement

Boolean Logic

Conditions use boolean values named after mathematician George Boole. A boolean is always exactly one of two values:

  • true (yes, on, 1)
  • false (no, off, 0)
  • Computers represent true as 1 and false as 0 in memory
  • All computer decisions come down to 1s and 0s

Real Computer Decisions

Every app on your phone or computer runs IF/THEN checks constantly. Some examples:

  • IF battery < 20% THEN show low battery warning
  • IF password is correct THEN log in ELSE show error
  • IF it is nighttime THEN use dark mode ELSE use light mode
  • Games use thousands of these checks every second to respond to players