Liste des Groupes | Revenir à cl c |
On Tue, 15 Apr 2025 11:30:24 +0100
bart <bc@freeuk.com> wrote:
>Let me ask you this: what exactly is the point of the 'while'>
statement in C? Since it can always be trivially be written as:
>
for (;cond;)
>
It seems to that most use cases (initialise, check exit condition,
change something that affects the letter), would suit 'for' better.
>
But since 'for' then becomes overloaded, there ought to be a
dedicated feature for simple iteration. So it seems the solution is
as a I suggested above.
I suspect that 'while' loop is here in C because Dennis Ritchie wanted
'do .. while() ' and thought that if the keyword is here anyway than
why not reuse it?
In the hindsight, probably a mistake.
Les messages affichés proviennent d'usenet.