I'd prefer to have some kind of goto, which enforces structured programming. Something like: double euclideanDistance(Range)(Range a, Range b, double limit) { limit *= limit; double result = 0; foo: { for (; !a.empty; a.next, b.next) { enforce(!b.empty); auto t = a.head - b.head; result += t * t; if (result >= limit) break foo; } enforce(b.empty); } return sqrt(result); }