Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Richard Heathfield Newsgroups: comp.lang.c Subject: Re: Loops (was Re: do { quit; } else { }) Date: Tue, 15 Apr 2025 13:51:59 +0100 Organization: Fix this later Lines: 29 Message-ID: References: <87ikndqabc.fsf@nosuchdomain.example.com> <20250410115501.000037a5@yahoo.com> <20250410080629.532@kylheku.com> <87a58mqt2o.fsf@nosuchdomain.example.com> <20250413072027.219@kylheku.com> <20250415153419.00004cf7@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 15 Apr 2025 14:52:00 +0200 (CEST) Injection-Info: dont-email.me; posting-host="518c54d255421e14a04c2a4e021ec872"; logging-data="3890014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AUnI4YqB8IQeLrKu+dXJYX9hs22VuV5bi+bgofoY04A==" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:jXQxLeZwt63+YOJX3rSmZ+3ky1M= Content-Language: en-GB In-Reply-To: <20250415153419.00004cf7@yahoo.com> On 15/04/2025 13:34, Michael S wrote: > 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. In hindsight: $ find . -name \*.c | xargs cat | wc -l 126343 $ find . -name \*.c | xargs grep -w while | wc -l 556 $ find . -name \*.c | xargs grep -w for | wc -l 1258 So although I use for() about twice as much as I use while(), I still find while a better option one time in three. That's useful enough to make it worth keeping in the toolbox. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within