Studyfin Studyfin ✨ Sign up free

Boolean logic (AND, OR, NOT)

Grade 5 · Coding · Free lesson

Hello! I am Studyfin, your coding buddy. Today we will learn how computers make decisions using simple rules!

Computers are smart, but they see the world in a simple way. They use Boolean logic, which means everything is either True or False. We can combine these ideas using words like AND, OR, and NOT.

The rule AND means both things must be True. Imagine you want to play outside. You can go only if it is sunny AND you have your shoes on!

SunnyANDShoes On

The rule OR is different because only one thing needs to be True. You can have a snack if you have an apple OR if you have a banana!

AppleORBanana

The rule NOT flips everything to its opposite. If a statement is True, putting NOT in front of it makes it False. If it is NOT raining, then you can go play!

✏️ Worked example

Let us solve a Boolean puzzle! We want to see if the computer will let us play a game. The rule is: (You are finished with homework) AND (You NOT have chores left). Let us test this with your current day: You finished your homework (True), and you have no chores left (True). Will the computer say True or False?

  1. Look at the first part: 'You finished your homework'. Since you did, this part is True.
  2. Look at the second part: 'You NOT have chores left'. Since you have no chores left, 'have chores left' is False.
  3. Apply the NOT rule to the chores part: NOT False becomes True.
  4. Now combine both parts with the AND rule: True AND True.
  5. Since both sides are True, the final answer is True! You can play your game!
Want the full interactive lesson — quiz, animations, and Finn cheering them on?

More Coding lessons