April 8th, 2007, 10:22 AM
Re: Bagels(fermi,pico,bagels) code help
In purely practical terms, the idea is that you put the loop condition at the start if the loop can have zero or more iterations, and you put it at the end if there must always be at least one iteration. This way the code structure explicitly mirrors the requirement.
Originally Posted by petes1234
Having said that, the vast majority of the code I see uses the 'for' loop whatever the situation... it seems that most coders find it easier to follow if the same control structure is used for every loop rather than changing the control structure to reflect the flow.
The key to performance is elegance, not batallions of special cases...
J. Bently & D. McIlroy
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.