wunder beta

📘 Keep control flow from meaning spaghetti

Control flow is sequence, selection, and iteration — not spaghetti. Clean conditions and termination make programs predictable.

4
lessons
~20 min
to learn
Adults
level
Start the course →

What you’ll learn

  1. Sequence, Selection, Iteration: The Three Building BlocksExplain why sequence, selection, and iteration are enough to express a flowchart, and identify each structure in code.Control flow is the rule a language uses to decide what runs next. Böhm and Jacopini (CACM, 1966) showed any flowchart can be rewritten with sequence, selection, and iteration — so an unrestricted goto is never required for expressiveness. You learn to see the default path, the one-of-many path, and the repeating path, and why they nest.
  2. Boolean Conditions and Selection in DepthBuild correct Boolean conditions with comparison and logical operators, and reason about short-circuit evaluation and multi-way selection.Selection is only as correct as the condition that drives it. This lesson covers comparison versus assignment, and/or/not, precedence, Python truthiness, short-circuit evaluation as a correctness tool, and why C switch falls through while Python match does not.
  3. Loops, Termination, and Clean Control FlowChoose the right loop, guarantee termination, and use break, continue, and guard clauses without scattering exits.A loop must make progress toward a stopping condition or it hangs. This lesson distinguishes definite from indefinite and pre-test from post-test, treats off-by-one as a boundary-and-invariant problem, and reads Dijkstra's 1968 letter as an argument about coordinates, not a ban on early return.
  4. Workshop: Build a Control-Flow Mini ArtifactApply sequence, selection, and iteration to build and smoke-test a small number-classification program with validated input.You combine the three structures in one artifact: an indefinite read-until-quit loop, a guard for non-numeric input, a three-way sign chain that includes zero, and a separate parity test. McCabe's M = E − N + 2P, counted on binary predicates, tells you how many independent paths a thorough test would cover — and why five smoke cases are not that set.

Grounded in trusted sources

  • Flow Diagrams, Turing Machines and Languages with Only Two Formation Rules — Communications of the ACM 9(5), May 1966 (Corrado Böhm and Giuseppe Jacopini)
  • Go To Statement Considered Harmful — Communications of the ACM 11(3), March 1968 (Edsger W. Dijkstra)
  • Truth Value Testing and Boolean Operations — Python Software Foundation — Library Reference
  • More Control Flow Tools — Python Software Foundation — Tutorial §4 (if, for, break/continue, match)
  • Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric — NIST Special Publication 500-235 (Watson and McCabe, 1996) — restates McCabe 1976
  • switch statement — cppreference — C fall-through without break
  • Corrado Böhm and Giuseppe Jacopini, 'Flow Diagrams, Turing Machines and Languages with Only Two Formation Rules,' Communications of the ACM 9(5), May 1966, pp. 366–371.
  • Python Software Foundation, '4. More Control Flow Tools,' The Python Tutorial.

Every Wunder lesson is built from real, reputable sources — never invented.

Related courses

Wunder is a personalized learn-anything platform — tell it any topic and it builds a beautiful, fact-checked course in minutes, with narration, a knowledge check, and a college-style University track.

All topics · Home

© 2026 Wunder Learning LLC · Terms & Privacy