Skip to content

Reference: Conditional logic

Quick-lookup pages. Short, dense, and designed to skim — the sort of thing you keep a tab open on while you're writing conditions. If you're here to learn the topic for the first time, start with Learn instead.

Pages in this section

  • Comparison and boolean operators — the operator table with semantics, short-circuit behaviour, chained comparisons, and precedence.
  • Truthiness rules — the canonical list of falsy values, plus __bool__ and __len__ semantics for custom classes.
  • match/case syntax — every pattern type at a glance: literal, capture, sequence, mapping, class, OR, and guarded.