Deutsch English Français Italiano |
<vto2mb$20c4n$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: bart <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Loops (was Re: do { quit; } else { }) Date: Wed, 16 Apr 2025 12:01:31 +0100 Organization: A noiseless patient Spider Lines: 45 Message-ID: <vto2mb$20c4n$1@dont-email.me> References: <vspbjh$8dvd$1@dont-email.me> <87ikndqabc.fsf@nosuchdomain.example.com> <20250410115501.000037a5@yahoo.com> <vt8ei8$2vn84$1@dont-email.me> <20250410080629.532@kylheku.com> <vt94q5$3jjod$1@dont-email.me> <vt9628$3hhr8$3@dont-email.me> <vtammh$174ev$1@dont-email.me> <vtavn9$1dp7m$3@dont-email.me> <vtb8nv$1plb2$2@dont-email.me> <vtba81$1qfbm$1@dont-email.me> <vtbc6o$1te2o$1@dont-email.me> <vtbhjv$24api$1@dont-email.me> <vtbn2k$293r1$1@dont-email.me> <vtc19j$2kqlj$1@dont-email.me> <87a58mqt2o.fsf@nosuchdomain.example.com> <vtc7mp$2q5hr$1@dont-email.me> <vtcqf6$3j95s$1@dont-email.me> <vtdh4q$b3kt$1@dont-email.me> <vtf7fe$1qtpg$1@dont-email.me> <vtgfuf$31ug1$1@dont-email.me> <20250413072027.219@kylheku.com> <vtgpce$39229$1@dont-email.me> <vti2ki$g23v$1@dont-email.me> <vtin99$vu24$1@dont-email.me> <vtiuf0$18au8$1@dont-email.me> <vtj97r$1i3v3$1@dont-email.me> <vtl166$36p6b$1@dont-email.me> <vtlcg0$3f46a$2@dont-email.me> <vtnekn$1fogv$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 16 Apr 2025 13:01:31 +0200 (CEST) Injection-Info: dont-email.me; posting-host="507c987f563baeac8cb4b74b82477869"; logging-data="2109591"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+i3cEEJ7EE4cg1NjSKgSl1" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:MnakBwfAk/qHE25E8+3jjz6Agwg= In-Reply-To: <vtnekn$1fogv$1@dont-email.me> Content-Language: en-GB On 16/04/2025 06:19, Janis Papanagnou wrote: > On 15.04.2025 12:30, bart wrote: > (One of your fundamental problems with "C" seems to be to understand > the 'for' keyword meaning only counted loops with one variable and a > simple +1 increment. - I can't help you here.) And your problem seems to the opposite: being unable to understand that for-loop (perhaps spelled 'do') can be a specialised feature to iterate one or more variables over a predetermined range or set of values. Unlike C's for, which is just a gimmick where you bundle three potentially unrelated expressions and hope for the best. Everyone here is defending the latter to the death. Why? Apparently the ONLY argument is 'flexibility'. Having to writing a simple iteration in such a convoluted and unchecked manner is much better because - you can use the same syntax to iterate over a list! > I've written code where the logic required comparisons of i < N-1 > and also i <= N . So what? - Should I not do that because you are > getting confused when inspecting my code? This is worrying. So you have a bunch of code with multiple like this: for (i=0; i<N; ++) for (i=0; i<N; ++) for (i=0; i<=N; ++) for (i=0; i<N; ++) And you notice one has <= while the others have <. But according to you, this is nothing remarkable and raises no flags. Obviously the author intended to iterate one more time there! With language-supported iteration, the comparison operator is not exposed, so the programmer cannot accidentally type the wrong one. (I see I have ++ and not ++i; never mind. It is telling that it took me a minute to notice!)