Sujet : Re: Loops (was Re: do { quit; } else { })
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 15. Apr 2025, 13:34:19
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250415153419.00004cf7@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
User-Agent : Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
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.