---
title: "Conditions That Combine: And, Or and Not"
description: "One test is often not enough. Joining tests with and, or and not lets a single decision depend on several things at once, and each joiner changes when the branch is taken."
canonical: https://lightmysky.com/learn/computing/conditions-that-combine-and-or-and-not-mt_ZYdtXQZy5r
source: https://lightmysky.com/learn/computing/conditions-that-combine-and-or-and-not-mt_ZYdtXQZy5r.md
retrieved: 2026-09-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Conditions That Combine: And, Or and Not

One test is often not enough. Joining tests with and, or and not lets a single decision depend on several things at once, and each joiner changes when the branch is taken.

Subject: Computing · Area: Computing Fundamentals · Ages 12 to 13
Page: https://lightmysky.com/learn/computing/conditions-that-combine-and-or-and-not-mt_ZYdtXQZy5r

## Ready when they can

- Write a condition true only when two things hold at once, and one true when either holds
- Say what not turns each of those into, with a case that shows the difference
- Find the case that breaks a condition that used or where it needed and

## Lesson: Combining tests with and, or, and not

One test is often not enough. Joining tests with and means every part must be true. Joining with or means at least one part must be true.

**Example.** You want a bonus level when the score is over ten and the timer has not run out. With a score of 12 and time left, both parts hold, so the level opens. With a score of 12 but no time left, one part fails, so it stays shut.

The word not flips any test to its opposite. Saying not hungry is true exactly when hungry is false. So not in front of a joined test flips the whole result, and you can check this with one case at a time.

The classic bug is writing or where you needed and. Test it with a case where only one part holds. If the branch is taken when it should not be, swap or for and.

**Recap.** And needs every part true, or needs just one true part, not flips a test, so try a case where only one part holds to catch an or where you needed and.

## Practice

8 questions on this page, each with its working shown.

## Needs first

- [Events: Programs That React to What the User Does](https://lightmysky.com/learn/computing/events-programs-that-react-to-what-the-user-does-mt_HFtGUhZHz4)

## Opens up

- [Boolean Expressions and Comparison Operators](https://lightmysky.com/learn/computing/boolean-expressions-and-comparison-operators-mt_0aIh-DPCZ4)
- [Random Numbers and Programs That Differ Each Run](https://lightmysky.com/learn/computing/random-numbers-and-programs-that-differ-each-run-mt_t8GTOW3hyN)
