Path: csiph.com!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Clutterfreak 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 01:51:06 -0500 Message-ID: References: <_2w6J.38725$GD7.28148@fx23.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 4 Oct 2021 06:51:07 -0000 (UTC) Injection-Info: solani.org; logging-data="2222"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Cancel-Lock: sha1:GDa+w7U0kwvM1nHczuOC1Zz/A/g= X-User-ID: eJwFwQkBwDAIA0BLpbyRs0LwL2F3riHRaeFhvr7iOfswcbved8Ssfai1Gc2596sleIh54hDikIZOjVIs5AdsZxXl In-Reply-To: <_2w6J.38725$GD7.28148@fx23.iad> X-Antivirus-Status: Clean X-Antivirus: Avast (VPS 211003-10, 10/3/2021), Outbound message Content-Language: en-US Xref: csiph.com comp.os.linux.setup:4725 comp.os.linux.advocacy:595253 sci.physics:833691 On 10/4/2021 12:12 AM, Branimir Maksimovic wrote: > On 2021-10-04, Clutterfreak wrote: >> On 10/3/2021 8:47 PM, rbowman wrote: >>> 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. >> >> >> My point is that "for loop" is a screwdriver of length 9.0 inches and >> the other two "while things" are screwdrivers of 9.00001 inches and >> 9.00002 inches respectively :) >> >> I don't see them as one being a screwdriver and the other a chisel at >> all. All three are _practically_ EXACTLY the same screwdriver. >> > Rust and Swift use for loop in terms of counting loop, while > while loop for rest of cases ... > For loop is of course slightly easier to use when the maximum number of iterations is known in advance. As long as the test expression is boolian true it keeps repeating. So you are free to arrange your condition in any manner you deem necessary without modifying the counter variable inside the block. This is the form of for loop that is identical to a while loop: int i=1 for (;i<=someValue;) { .... i++; } It even looks like a while loop :) But certainly works like a while loop including the fact that in this form of for loop scope of the counter isn't limited to the for loop block (in standard form of for loop counter value only exists inside for loop block). -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus