Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: James Kuyper Newsgroups: comp.lang.c Subject: Re: Loops (was Re: do { quit; } else { }) Date: Tue, 15 Apr 2025 22:37:30 -0400 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: <20250413072027.219@kylheku.com> <20250415053852.166@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 16 Apr 2025 04:37:51 +0200 (CEST) Injection-Info: dont-email.me; posting-host="c987168a027414eea408640e9a1bdb09"; logging-data="1278983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+b3FrdXHM+Jug3F1lSuxok2m9PGReNuFk=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:BdddeRSBlMAoWdigQg3jTvHqL30= Content-Language: en-US In-Reply-To: On 2025-04-15, bart wrote: > Note that C's for-loop is dumb; it merely take three expressions A B C > that can be completely unrelated, and arranges them into a loop: > > A; while (B) {...; C} Note that this problem is not unique to the for() statement. An assignment statement allows you to arrange three unrelated expressions together like A = B + C; "Doctor, it hurts when I hit my head with a hammer!" "Then stop doing that." The key to using the for() statement is to make sure the three expressions are related appropriately. Many different powerful and useful ways of using a for() statement have been shown in this thread that are not equivalent to for(int i=start; i