9

Lesson 9 of 20 ยท Logic

Logic โ€” Part 17

True and false. Combine conditions. This is part 17 of 20.

What you'll learn

You will learn that comparisons produce True or False (booleans), and these power every decision in code.

Steps

  1. 1Computers think in True and False. a > 3 asks 'is 5 greater than 3?' โ€” yes, so it's True.
  2. 2a > 10 asks 'is 5 greater than 10?' โ€” no, so it's False. These True/False values are called booleans.
  3. 3Other comparisons: == (equal?), != (not equal?), < (less than?), >= (greater or equal?). They all give True or False.
  4. 4Booleans power every decision in code. Every 'if' statement checks a boolean. Every game checks: is the player alive? True or False!

Key Terms

Boolean
A value that is either True or False.
Compare
Checking how two values relate: equal (==), greater (>), less (<).
Condition
Something that is true or false. Programs use conditions to make decisions.
Python 3
Output
Loading Python... This may take a few seconds.

Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!

๐Ÿ–จ๏ธ

Checkout complete lesson on Logic for 4th Grade

Get the full Logic track as a printable PDF โ€” all lessons, worksheets, and answer keys.

View in Shop

Your Cart (0)

Your cart is empty

Browse our shop to find activities your kids will love

Logic โ€” Part 17 โ€” Logic | 4th Grade Coding | LittleActivity | LittleActivity