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!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: stopping a loop iteration without exiting it Date: Thu, 4 Jan 2018 19:17:54 -0600 Organization: JSA Research & Innovation Message-ID: References: <81971548-23c9-4927-a6a8-6f0f1dba896b@googlegroups.com> Injection-Date: Fri, 5 Jan 2018 01:17:55 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="20198"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:49760 Date: 2018-01-04T19:17:54-06:00 List-Id: "Jeffrey R. Carter" wrote in message news:p2kufi$f1l$1@dont-email.me... > 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. Evey case where it is needed by its nature involves "convuluted code". To claim that such code can be simplified, however, defies my experience. There are a number of instances of it in the spam filter. When it is determined that a particular pattern cannot possibly match, one does a "continue" to move on to the next pattern. This is usually in an inner loop (so this is acting as a combination exit and continue). The rules for the spam filter turn out to be very complex, so the code implementing them also end up complex; simplifying the rules leads to allowing spam through or blocking "ham" (good mail). Randy.