From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: stopping a loop iteration without exiting it Date: Thu, 4 Jan 2018 11:08:50 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <81971548-23c9-4927-a6a8-6f0f1dba896b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 4 Jan 2018 10:08:50 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="8df34817da99b2b5c4fbc87285c186b2"; logging-data="15413"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TBPYQEFOawQjJ1IRvuHIIY0N9AUqxp4o=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 In-Reply-To: Content-Language: en-US Cancel-Lock: sha1:ARuoW7ag1R+xJ8YMODmi1wqW874= Xref: reader02.eternal-september.org comp.lang.ada:49747 Date: 2018-01-04T11:08:50+01:00 List-Id: On 01/04/2018 12:17 AM, Robert A Duff wrote: > > Jeff's suggestion (nested 'if' in the loop) is a good one when it works, > but it doesn't work when the "continue" is nested within further control > constructs. I have never seen a real-world situation in which a "continue" was needed. The vast majority of times that I've seen where people have claimed they needed it, it could be replaced by an "if". The few remaining cases involved very convoluted and unreadable code. When it was rethought and simplified, it no longer needed a "continue". I would be interested in seeing real-world examples where it was needed. An informative data point is the book /Software Tools/, which presents a whole lot of code in Ratfor, which has an equivalent of "continue". Interestingly, it is never used. -- Jeff Carter "Damn it, Jim, I'm an actor, not a doctor." 124