liveBook · Manning

Loop

A loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.

How 27 Manning books explain it

Tiny Python Projects: Learn coding and testing with puzzles and games

A while loop is a Python control-flow construct that repeatedly executes a block while its condition is true.

How it is used
Processes characters, lines, files, generated ranges, and function inputs in small Python programs.
How deep it goes
Explains iteration, accumulation, nesting, range control, and refactoring, but does not descend into interpreter internals.
Examples
Uses text translation, ransom capitalization, file counting, random insults, song verses, and manual CSV parsing.
What you can do after
Build it from scratch, process iterable values, accumulate transformed results, nest loops, and refactor tested loops into comprehensions or map.

Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains loop →

Learn AI-Assisted Python Programming, Second Edition

A loop is a programming construct that repeatedly executes a block of code while iterating over values or while a condition holds.

How it is used
Processes each value in a known string or list while teaching readers to recognize common Python code.
How deep it goes
Explains loop variables, iterations, indentation, range, indexes, nesting, and contrast with while loops, but not implementation internals.
Examples
Uses letters, animals, word scoring, password characters, country pairs, Olympic medal lists, and list indexes.
What you can do after
Apply it to iterate through sequences, process list indexes, nest repetition, and identify indentation or infinite-loop errors.

Read how Learn AI-Assisted Python Programming, Second Edition explains loop →

Get Programming: Learn to code with Python

A loop is a control-flow construct that repeatedly executes a code block while iterating over values or satisfying a continuation rule.

How it is used
Uses loops to replace repeated statements with concise code for tasks performed a known number of times or until a condition changes.
How deep it goes
Traces loop-variable values, custom ranges, condition checks, and infinite-loop risks; stops at introductory Python examples.
Examples
Uses repeated printing, dice rolls, a word-guessing game, and letter tiles to show repetition in action.
What you can do after
Build it from scratch: write Python `for` and `while` loops, choose between them, and avoid a condition that never changes.

Read how Get Programming: Learn to code with Python explains loop →

100 Java Mistakes and How to Avoid Them

A for loop is a Java loop statement with initialization, condition, and iteration components that controls repeated execution.

How it is used
Controls repeated Java execution while framing common range, direction, termination, and iteration mistakes.
How deep it goes
Explains range direction, bounds, overflow, iterator behavior, tests, and tool diagnostics without specifying loop bytecode internals.
Examples
Uses descending ranges, inclusive maximum bounds, mutated ArrayLists, Stream pipelines, and tail-recursive string search.
What you can do after
Diagnose/debug with it by testing boundaries, spotting direction mismatches, and choosing safer iteration forms.

Read how 100 Java Mistakes and How to Avoid Them explains loop →

Clojure: The Essential Reference

A loop is a language construct that repeatedly evaluates a body while passing through successive control states or values.

How it is used
Contrasts value-producing iteration through immutable bindings with mutable Java for-loops and side-effecting while loops.
How deep it goes
Explains loop bindings, recur targets and tail-position requirements, then distinguishes while’s test-and-body contract.
Examples
Works through squared numbers and Fibonacci, alongside stream hashing, a status thread, and sequence-based printing.
What you can do after
Build it from scratch with loop/recur, or choose while for side-effecting tests and sequence operations for ordinary iteration.

Read how Clojure: The Essential Reference explains loop →

Python How-To

A while loop repeatedly executes a block of code while a Boolean condition remains true.

How it is used
Uses loops to repeat operations over iterable items or until a condition changes.
How deep it goes
Explains iterator creation, item retrieval, and exhaustion, then demonstrates loop control and readability trade-offs.
Examples
Demonstrates numbered prime values, a while-loop counter, and a search for the first urgent task.
What you can do after
Apply loops in Python to process items, repeat conditional work, and stop a search early.

Read how Python How-To explains loop →

Modern C, Third Edition

A for statement is a C iteration statement that controls repeated execution using initialization, a continuation condition, and an iteration expression.

How it is used
Uses for statements as the preferred form for domain iteration and as structured control flow.
How deep it goes
Explains execution order, counter scope, loop variants, and progress concerns, with examples of break and continue.
Examples
Illustrates array-element squares, countdowns, bounded iteration, and an iterative multiplicative-inverse approximation.
What you can do after
Apply for loops to domain iteration and evaluate their termination and observable progress.

Read how Modern C, Third Edition explains loop →

Design for Developers

A design approach that repeatedly tests, evaluates, and refines a product through successive cycles.

How it is used
Guides repeated improvements to websites and web applications by checking whether designs meet users’ needs.
How deep it goes
Lays out research, UX design, design and build, and evaluation as phases, with feedback prompting refinement or renewed research.
Examples
Contrasts an unresearched client web application requiring late rework with earlier prototype testing, and distinguishes low-fidelity from nearly complete designs.
What you can do after
Practice/perform it by researching needs, designing and building a solution, testing it, and using feedback to decide what to change next.

Read how Design for Developers explains loop →

Julia as a Second Language

A loop is a programming construct that repeatedly executes code while a specified condition remains true or until a termination condition is met.

How it is used
Uses loops to repeat calculations and build mathematical tables and functions.
How deep it goes
Works through while conditions, ranges, and for loops, then identifies the collection iteration interface.
Examples
Uses printed ranges, a factorial function, and an iterative Fibonacci calculation.
What you can do after
Build loops from scratch in Julia to traverse ranges and accumulate results.

Read how Julia as a Second Language explains loop →

Python Workout: 50 ten-minute exercises

A loop is a control-flow construct that repeatedly executes a block of code.

How it is used
Deploys direct iteration for input-driven exercises, string processing, file analysis, and commands with side effects.
How deep it goes
Explains direct item iteration, enumerate, side effects, and alternatives through multiple exercises, but does not cover loop internals.
Examples
Uses a guessing game, Pig Latin translation, file statistics, filename creation, word lengths, and indexed alphabet output.
What you can do after
Apply it to process iterable items, accumulate results, perform side effects, and select comprehensions for transformations.

Read how Python Workout: 50 ten-minute exercises explains loop →

Learn Go with Pocket-Sized Projects

A for loop is Go's looping construct for repeatedly executing a block with optional initialization, condition, and post-iteration expressions.

How it is used
Deploys iteration across slices, arrays, maps, output routines, and table-driven tests.
How deep it goes
Defines counted, conditional, infinite, and range forms, including index and value selection, without deeper runtime internals.
Examples
Demonstrates book-list printing, bookworm comparison helpers, and map-driven test cases.
What you can do after
Apply it via Go syntax to repeat work, traverse collections, print results, and compare structured test data.

Read how Learn Go with Pocket-Sized Projects explains loop →

Kotlin in Action, 2E

A loop is a control structure that repeatedly executes a block of code according to a condition or over a sequence of values.

How it is used
Iterate over collections, maps, ranges, and condition-controlled work in Kotlin programs.
How deep it goes
Explains loop forms through ranges, map destructuring, indexing, and nested-loop labels; defers destructuring details.
Examples
Demonstrates color collections, binary character maps, indexed lists, Fizz-Buzz, and reverse stepped counting.
What you can do after
Apply it via Kotlin loop syntax to traverse collections, maps, and numeric ranges without manual index updates.

Read how Kotlin in Action, 2E explains loop →

Python Workout, Second Edition

A for loop is a control-flow construct that repeatedly executes a block while iterating over items in an iterable.

How it is used
Uses direct iteration to process each item, perform side effects, or support transformations across Python iterables.
How deep it goes
Descends from direct iteration and loop choice to iter, next, __iter__, __next__, and StopIteration, without covering broader control-flow syntax.
Examples
Demonstrates indexed alphabet output, number guessing, Pig Latin translation, file creation, and comma-joined numeric output.
What you can do after
Build it from scratch by iterating over sequences, unpacking enumerate results, selecting comprehensions, and implementing repeated-input exercises.

Read how Python Workout, Second Edition explains loop →

Statistics Slam Dunk

A for loop is a control-flow construct that executes a block of code once for each value in a finite sequence or iterable.

How it is used
Automates repeatable R tasks such as generating multiple NBA Lorenz curves.
How deep it goes
Defines loop syntax, explains index replacement, and demonstrates a multi-plot workflow without covering advanced loop patterns.
Examples
Demonstrates multiplication across 1:5 and Lorenz curves across four NBA seasons.
What you can do after
Apply it via R to replace repeated code with one maintainable operation.

Read how Statistics Slam Dunk explains loop →

Grokking Simplicity

An iteration construct that repeatedly executes a block while progressing through a sequence or range of values.

How it is used
Uses for loops as algorithmic stepping stones toward clearer functional code.
How deep it goes
Explains loop-to-tool refactoring through behavioral reconstruction and code clues, without examining loop internals.
Examples
Uses nested loops, array slicing, accumulation, and moving averages as refactoring examples.
What you can do after
Apply functional tools to replace existing for loops incrementally.

Read how Grokking Simplicity explains loop →

Learn SQL in a Month of Lunches

A SQL procedural loop repeatedly executes a block of statements while its control conditions permit.

How it is used
Processes cursor result sets row by row inside stored procedures.
How deep it goes
Explains declaration, opening, fetching, condition handling, exit, and cleanup, but does not compare complete loop alternatives.
Examples
Demonstrates order totals and annual author payments using named cursor loops.
What you can do after
Operate/configure MySQL cursor loops that fetch rows, calculate values, conditionally insert records, and terminate safely.

Read how Learn SQL in a Month of Lunches explains loop →

The Well-Grounded Rubyist, Fourth Edition

A loop is a control-flow construct that repeatedly executes a segment of code according to an unconditional, conditional, or collection-based rule.

How it is used
Repeats code indefinitely, under a condition, or once per collection value.
How deep it goes
Works through break, next, conditional test placement, and a loop reimplementation using yield.
Examples
Uses a counter, integer printing, Celsius-to-Fahrenheit conversion, and a loop-like method.
What you can do after
Build it from scratch with a method that repeatedly yields, and choose a Ruby loop form for a repetition task.

Read how The Well-Grounded Rubyist, Fourth Edition explains loop →

The Quick Python Book, Fourth Edition

A for loop is a control-flow construct that iterates over the items supplied by an iterable.

How it is used
Uses for loops to process iterable values, including lines of a file.
How deep it goes
Explains iteration, indentation, break, continue, and the optional else block through runnable examples.
Examples
Demonstrates reciprocal calculation with early exit and file cleaning with a reusable translation table.
What you can do after
Practice writing Python loops that skip items, stop early, and avoid unnecessary repeated work.

Read how The Quick Python Book, Fourth Edition explains loop →

Modern C

A for loop is a C iteration construct that repeatedly executes a statement while controlling initialization, continuation, and update expressions.

How it is used
Controls repeated execution, especially iteration over a defined domain.
How deep it goes
Defines syntax, evaluation order, scoping advice, variants, and termination, while deferring size-type details.
Examples
Uses bounded counting, countdowns, dynamic stopping bounds, infinite loops, and Heron approximation.
What you can do after
Build it from scratch by selecting initialization, condition, update, and body clauses for repeated C tasks.

Read how Modern C explains loop →

Learn Rust in a Month of Lunches

A for loop is Rust iteration syntax that repeatedly executes a block for each item produced by an iterable value.

How it is used
Uses for loops to repeat an action over ranges, ignored values, and collection items.
How deep it goes
Explains syntax, inclusive and exclusive ranges, unused variables, and tuple patterns without descending into iteration internals.
Examples
Demonstrates numeric ranges, ignored values, unused-variable warnings, tuple destructuring, and vector indexing.
What you can do after
Apply via Rust syntax to repeat work over ranges or collection items and respond appropriately to compiler warnings.

Read how Learn Rust in a Month of Lunches explains loop →

Build an AI Agent (From Scratch)

A loop workflow repeatedly runs one or more agents across iterations until a stopping condition is met or an iteration limit is reached.

How it is used
Uses repeated agent passes to refine outputs against a measurable stopping condition.
How deep it goes
Explains nested execution, context passing, stop-condition checks, and iteration limits with a concrete implementation.
Examples
Uses scored marketing-copy reviews, keyword checks, and minimum-iteration content-length checks.
What you can do after
Build it from scratch by defining an agent sequence, a stop condition, and a maximum iteration count.

Read how Build an AI Agent (From Scratch) explains loop →

100 C++ Mistakes and How to Avoid Them

A for loop is a C++ loop construct that places initialization, continuation testing, and iteration update in its control statement around a loop body.

How it is used
Uses for loops to express repetition while keeping initialization, continuation testing, and updating together.
How deep it goes
Defines the loop’s control sections and explains continue behavior, stopping short of deeper language internals.
Examples
Uses a while loop that can run indefinitely after continue and a vector maximum loop with a locally declared index.
What you can do after
Apply loop control safely by accounting for updates around continue and limiting control-variable scope.

Read how 100 C++ Mistakes and How to Avoid Them explains loop →

Fast Python: High performance techniques for large datasets

How it is used
Compares row-wise pandas traversal strategies while calculating tip amounts relative to total amounts.
How deep it goes
Benchmarks explicit indexing, iterrows, itertuples, apply, and vectorization, without examining loop internals.
Examples
Uses taxi-trip rows to calculate tip fractions and compare traversal runtimes.
What you can do after
Evaluate row-processing choices by comparing runtimes and favoring vectorization when possible.

Read how Fast Python: High performance techniques for large datasets explains loop →

100 Go Mistakes and How to Avoid Them

A classic for loop is a Go loop construct controlled by initialization, condition, and post statements rather than a range clause.

How it is used
Uses explicit initialization, condition, and post statements to control iteration and mutate indexed data.
How deep it goes
Traces condition evaluation, slice growth, copied range values, and deferred cleanup, but stops short of implementation internals.
Examples
Uses growing-slice loops, account updates, channel-driven file processing, and per-iteration deferred file closure.
What you can do after
Diagnose nontermination, copied-value mutations, and resource leaks by tracing loop conditions, element access, and defer scope.

Read how 100 Go Mistakes and How to Avoid Them explains loop →

Rust in Action: Systems programming concepts and techniques

A for loop repeatedly executes a block while iterating over the elements of a sequence or iterator.

How it is used
Teaches readable iteration through collections, ranges, and iterators while highlighting ownership and borrowing choices.
How deep it goes
Explains syntax, ownership modes, references, ranges, indexing pitfalls, and compiler expansion, but defers detailed rationale to ownership treatment.
Examples
Uses collection traversal, fixed-count ranges, mutable element updates, and file hexdump processing as concrete examples.
What you can do after
Apply for loops to traverse collections, borrow or mutate elements, repeat fixed actions, and process buffered file data.

Read how Rust in Action: Systems programming concepts and techniques explains loop →

Go in Action, Second Edition

A for loop is a Go control-flow construct that repeatedly executes a block according to optional initialization and post clauses and a loop condition or range clause.

How it is used
Uses for loops to scan strings, traverse arrays, process streamed input, and accumulate results.
How deep it goes
Explains three-part execution, range value-copy behavior, indexed mutation, and Scanner termination, but defers broader loop forms.
Examples
Demonstrates character scanning, array traversal, reverse iteration, skipped elements, and line-by-line word counting.
What you can do after
Apply for loops to scan data, traverse collections, mutate indexed elements, and process Scanner input safely.

Read how Go in Action, Second Edition explains loop →

Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu

Iteration is the repeated processing of items in a collection or the repeated definition of infrastructure instances.

How it is used
Uses iteration to transform data, generate strings, and multiply or conditionally define Terraform resources.
How deep it goes
Explains resource, data, template, and dynamic-block iteration with examples, but defers detailed for-expression treatment.
Examples
Demonstrates template collection loops, repeated security-group ingress rules, and conditional HTTPS ingress generation.
What you can do after
Build dynamic Terraform configurations by transforming collections, multiplying resources, and toggling nested blocks.

Read how Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu explains loop →

Also covered in

What to know first

Related concepts

Questions about loop

What is loop?

A loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition.

Which Manning books explain loop?

Tiny Python Projects: Learn coding and testing with puzzles and games, Learn AI-Assisted Python Programming, Second Edition, Get Programming: Learn to code with Python, 100 Java Mistakes and How to Avoid Them, Clojure: The Essential Reference, Python How-To, Modern C, Third Edition, Design for Developers and 19 more.

What should I know before learning loop?

Manning books that teach loop usually introduce function, Python, array and Map first.

What is the difference between loop and comprehension?

A loop is a programming-language control-flow construct that repeatedly executes a block of instructions according to an iteration rule or continuation condition. A comprehension is a language construct that creates a collection by iterating over one or more sources, optionally filtering elements and transforming them.

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.