What If the Instructions Say “If…”?
Sometimes programs say things like:
-
If the button is pressed, do this
-
If the player loses, end the game
-
If the number is bigger than 10, show a warning
How does the computer brain handle that?
It uses logic gates — the same AND, OR, and NOT rules we learned before!
🧩 A Real Example
Let’s say a game says:
“If the player has 0 lives, show ‘Game Over.’”
That’s a decision.
So the brain checks the memory:
-
How many lives?
-
Is it 0?
If YES → show “Game Over”
If NO → keep playing
🔁 These Are Called “If” or “Compare” Instructions
The brain checks two things:
-
“Is A equal to B?”
-
“Is A bigger than B?”
-
“Is this switch ON?”
Then it chooses:
-
Do Step A
-
Or do Step B
This is how it decides what to do next.
💡 But It’s Still Just Following Rules
The brain isn’t thinking. It’s just checking:
“Which rule matches the current information?”
And then it moves on.