Control flow
Control flow is the order and branching of execution that determines which operations in a program or process run and when.
Modern C
Control flow is the order in which execution proceeds among statements and functions in a program.
- How it is used
- Frames how execution moves among statements and functions, while guiding readers toward readable, structured C control flow.
- How deep it goes
- Descends from sequencing and returns to basic-block boundaries, while deferring detailed jump and signal behavior.
- Examples
- Uses a startup-to-main-to-printf execution path, {} blocks, nested jumps, and controlling expressions as examples.
- What you can do after
- Evaluate/understand execution paths and structure C code so its control flow remains obvious.
Modern C, Third Edition
Control flow is the order in which execution proceeds among a program's operations and functions.
- How it is used
- Explains how C statements and functions are sequenced and how readable structure makes that sequence apparent.
- How deep it goes
- Descends from function returns to basic-block boundaries and structured composition, while deferring detailed signal and jump variations.
- Examples
- Uses startup-to-main-to-printf execution, function returns, compound statements, buried jumps, and intricate controlling expressions.
- What you can do after
- Evaluate/understand C execution paths by identifying basic blocks, function suspension and return, and visibly structured branching.
Build an AI Agent (From Scratch)
Control flow is the sequence and selection of computational operations that determines what a program does next.
- How it is used
- Frames control flow as the mechanism for executing multi-step agent tasks and expressing complex business logic.
- How deep it goes
- Explains selection, repetition, exception handling, and agent looping through concrete scenarios and Python listings.
- Examples
- Uses research agents, multi-file processing, and budget-and-rating product filtering as concrete examples.
- What you can do after
- Apply control flow through Python loops and conditionals to coordinate tools and automate multi-step processing.
Read how Build an AI Agent (From Scratch) explains control flow →
Functional Programming in Scala, Second Edition
Control flow is the ordering and transfer of execution among operations in a program.
- How it is used
- Represents effectful program sequencing explicitly so an interpreter can control execution.
- How deep it goes
- Defines three constructors and a tail-recursive interpreter, including delayed evaluation and continuation handling.
- Examples
- Uses printLine, forever, nested FlatMap structures, and unsafeRun as concrete artifacts.
- What you can do after
- Build effectful computations as data and interpret them with a tail-recursive unsafeRun loop.
Read how Functional Programming in Scala, Second Edition explains control flow →
Also covered in
- 100 SQL Server Mistakes and How to Avoid Them
- Modern Angular
- Julia as a Second Language
- Kotlin in Action, 2E
- Write Powerful Rust Macros
- Retrieval Augmented Generation, The Foundational IdeasIn early access (MEAP)
- Rust in Action: Systems programming concepts and techniques
- The Art of Unit Testing 3e
- The Well-Grounded Rubyist, Fourth Edition
- Get Programming: Learn to code with Python
- Python How-To
- Functional Programming in JavaScript
What to know first
- loopA loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- atomic_flagAn atomic flag is a standard atomic type representing a flag and providing indivisible operations to set or clear it for synchronization.
Related concepts
- conditional logicincludes · Conditional logic is a programming technique that evaluates conditions to select among execution paths, actions, or result values.
- loopincludes · A loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.
- threadincludes · A thread is a distinct sequence of execution with its own control flow and state, managed or scheduled by a processor, runtime, or operating system.
- data flowcontrasts with · Data flow is the movement and transformation of data through the components, operations, or processing stages of a system or program.
- DSPyused by · DSPy is a Python framework for declaratively programming, composing, evaluating, and optimizing language-model applications and pipelines.
- flowchartused by · A flowchart is a diagram that represents a process or computation as connected steps, actions, and decision points.
Questions about control flow
What is control flow?
Control flow is the order and branching of execution that determines which operations in a program or process run and when.
Which Manning books explain control flow?
Modern C, Modern C, Third Edition, Build an AI Agent (From Scratch) and Functional Programming in Scala, Second Edition.
What should I know before learning control flow?
Manning books that teach control flow usually introduce loop, function, array and atomic_flag first.
What is the difference between control flow and data flow?
Control flow is the order and branching of execution that determines which operations in a program or process run and when. Data flow is the movement and transformation of data through the components, operations, or processing stages of a system or program.
What kinds of control flow are there?
Kinds of control flow include conditional logic, loop and thread.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



