A continue statement skips the rest of the current loop body and proceeds to the loop’s next control check. In this inverse-computation loop, values greater than 1 are inverted, then continue prevents the remaining calculation from running on that iteration. section 3.2
Correcting the iteration side
for (size_t i = 0; i < max_iterations; ++i) { if (x > 1.0) { x = 1.0 / x; continue; } double prod = a * x; if (fabs(1.0 - prod) < eps) { break; } x *= (2.0 - prod); } Here, continue bypasses prod computation, the stopping test, and the update for the current pass. The for statement then performs its next control step. section 3.2
for (size_t i =0; i < max_iterations; ++i) {
if (x > 1.0) { // Checks if we are on the correct side of 1
x = 1.0/x;
continue;
}
double prod = a*x;
if (fabs(1.0 - prod) < eps) { // Stops if close enough
break;
}
x *= (2.0 - prod); // Heron approximation
}
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":0},{\"line\":0,\"ch\":3}],[{\"line\":0,\"ch\":5},{\"line\":0,\"ch\":11}],[{\"line\":1,\"ch\":2},{\"line\":1,\"ch\":4}],[{\"line\":6,\"ch\":2},{\"line\":6,\"ch\":4}],[{\"line\":3,\"ch\":4},{\"line\":3,\"ch\":12}],[{\"line\":5,\"ch\":2},{\"line\":5,\"ch\":8}],[{\"line\":1,\"ch\":2},{\"line\":1,\"ch\":4}],[{\"line\":6,\"ch\":2},{\"line\":6,\"ch\":4}],[{\"line\":6,\"ch\":6},{\"line\":6,\"ch\":10}],[{\"line\":7,\"ch\":4},{\"line\":7,\"ch\":9}]]"}
!@%STYLE%@!
Inspect the complete bounded loop showing continue alongside break and the Heron approximation. section 3.2




