liveBook · Manning

Do-while loop

Also called do loop

A do-while loop is a control-flow construct that executes its body before testing a condition, then repeats while the condition is true.

How 2 Manning books explain it

Modern C, Third Edition

A do-while loop is a C iteration statement that executes its body once and then repeats it while its controlling condition is true.

How it is used
Deploys post-tested iteration when an operation must execute before deciding whether repetition should continue.
How deep it goes
Defines syntax and execution order, demonstrates a numerical loop, and stops short of deeper control-flow mechanics.
Examples
Demonstrates Heron's approximation for a multiplicative inverse using a precision threshold and repeated updates.
What you can do after
Apply it via C syntax to repeat a body at least once and terminate after a condition becomes false.

Read how Modern C, Third Edition explains do-while loop →

Modern C

A do-while loop is a C iteration construct that executes its dependent statement before testing whether its condition remains true.

How it is used
Uses post-condition iteration when an operation must occur before deciding whether repetition should continue.
How deep it goes
Defines syntax, contrasts do with while, and demonstrates a numerical rewrite without developing implementation internals.
Examples
Demonstrates do by rewriting Heron’s approximation for computing multiplicative inverses.
What you can do after
Apply via C syntax to place a continuation test after an iteration body.

Read how Modern C explains do-while loop →

Also covered in

What to know first

Related concepts

Questions about do-while loop

What is do-while loop?

A do-while loop is a control-flow construct that executes its body before testing a condition, then repeats while the condition is true.

Which Manning books explain do-while loop?

Modern C, Third Edition and Modern C.

What should I know before learning do-while loop?

Manning books that teach do-while loop usually introduce conditional logic, scope, size_t and value first.

What is do-while loop a kind of?

Do-while loop is a kind of 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.

What is do-while loop also called?

Do-while loop is also called do loop.

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.