Liste des Groupes | Revenir à cl c |
On Mon, 3 Jun 2024 23:43:00 +0100, bart wrote:Now we know Keith was right that people are joking!
All that suggest sto me is that the language *needs* an explicit endlessI agree. Also it is common for a loop to have multiple exits, and I don’t
loop!
like treating one of them as a special “termination condition” above the
others, so I like to use “break” for all of them.
The “for” form not only caters for this, it allows handy initialization of
local variables that keep their value between loop iterations. E.g.
for (unsigned int i = length_of(array);;)
{
if (i == 0)
{
... not found ...
break;
} /*if*/
--i;
if (... array[i] matches what I want ...)
{
.. found ...
break;
} /*if*/
} /*for*/
Les messages affichés proviennent d'usenet.