liveBook · Manning

Do statement

A do statement is a loop construct that executes its body before testing a condition, so the body runs at least once.

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 statement →

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 statement →

Related concepts

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.