Every day you make decisions by asking yes-or-no questions. Is it raining? If yes, you grab an umbrella. If no, you leave it at home. Computers make choices the very same way, using something called an if-then decision.
An if-then decision has two parts. The if part is a yes-or-no question. The then part is what the computer does when the answer is yes. It is like a fork in the road where the program picks which way to go.
Here is an example from a game. If your score is more than 10, then you win a gold star. The computer checks your score, and only when the answer is yes does it hand you the star.
But what happens when the answer is no? Programs can have an else path too. If it is dark, then turn on the light, else keep it off. The computer picks one path for yes and a different path for no.
If-then decisions let programs feel smart. A game can decide when you level up, and a robot can decide when to stop. The computer is not really thinking, it is just checking a question and following the matching path.
When you write your own code, you get to invent the questions and the paths. You are teaching the computer how to choose, one yes-or-no question at a time.