Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: comp.os.linux.setup,comp.os.linux.advocacy,sci.physics Subject: Re: I think in FORTH & program in C/C++. Date: Mon, 4 Oct 2021 07:54:49 -0600 Lines: 66 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net u9rnWlyoqtDm+VVyZn0YEwMHxGCzAl8u9WKDNyWtZ5YQcE5B8X Cancel-Lock: sha1:uFwPFUPyXbez/0cuUOHzqJ13y2M= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 In-Reply-To: Xref: csiph.com comp.os.linux.setup:4727 comp.os.linux.advocacy:595262 sci.physics:833704 On 10/03/2021 10:50 PM, Clutterfreak wrote: > On 10/3/2021 8:47 PM, rbowman wrote: >> On 10/03/2021 07:02 PM, Clutterfreak wrote: >>> On 10/3/2021 12:49 PM, rbowman wrote: >>>> On 10/02/2021 11:12 PM, Clutterfreak wrote: >>>>> >>>>> There's not a repetition that a do/while or a while loop can perform >>>>> that cannot be performed by a for loop as efficiently and as clearly. >>>>> I've not, in my life, used any loop that had a "while" in it in any of >>>>> the few languages that I programmed with. I only see the word >>>>> "while" in >>>>> programming books and hear it others mentioning it. So it is not >>>>> needed. >>>>> It is just another alternator doing what alternators do. >>>> >>>> for (; test; ) { >>>> .... >>>> test = pigsFly(); >>>> } >>>> >>>> static int pigsFly(void) { >>>> return 0; >>>> } >>>> >>>> >>>> Congratulations! You've created a while loop assuming test is true at >>>> the onset. When you only have a hammer... >>>> >>>> Sooner or later it comes down to >>>> >>>> JZ get_me_out_of_here >>>> >>> >>> >>> Why would you want to use a for loop when you want block only to run >>> once? >>> >> >> The ... ellipses assumed several complex blocks, one path of one which >> included questioning if pigs can fly and there was no iteration such as >> >> for (i=0; i<=number_of_pigs; i++) { >> if (!can_pig_n_fly(i) break; >> } >> >> int can_pig_n_fly(int i) { >> if (moon_is_blue && i == 13) return 0; >> return 1; >> } >> >> >> I'm not arguing that you can't create the equivalent of a while loop >> with a for loop or that you can't use a screwdriver as a chisel. >> > > What value is assigned to number_of_pigs ? > > That was determined three functions ago and passed as a parameter. We have a programmer that pronounces parameter as para meter. 20 years ago he may not have known the standard pronunciation; now I think he does it because it sets one of the manager's teeth on edge.