|
|
Log in / Subscribe / Register

Or even old loop constucts

Or even old loop constucts

Posted Jul 5, 2013 17:03 UTC (Fri) by nybble41 (subscriber, #55106)
In reply to: Or even old loop constucts by etienne
Parent article: Philosophy and "for" loops — more from Go and Rust

> The difference is that you may not want to end the loop either at the beginning or at the end - maybe you have to do something once even if the loop shall not be executed once.

That is exactly what the C, Ada, and Rust versions do. There is no behavioral difference between

loop;
S;
if B then leave;
T;
again

and the C equivalent

for (;;) {
  S;
  if (B) break;
  T;
}


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds