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!news.mixmin.net!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: stopping a loop iteration without exiting it Date: Thu, 4 Jan 2018 10:47:22 +0200 Organization: Tidorum Ltd Message-ID: References: <81971548-23c9-4927-a6a8-6f0f1dba896b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 54iN/FXlPsmY9rr4qDCJZQ8lN/3bFR0mjh/a9YBMAlQoWmuYFe Cancel-Lock: sha1:+2/qrNVZ/eCgDZnbwmull1mBfU4= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Xref: reader02.eternal-september.org comp.lang.ada:49745 Date: 2018-01-04T10:47:22+02:00 List-Id: On 18-01-04 01:17 , Robert A Duff wrote: > "Randy Brukardt" writes: > >> A "goto" is *not* stupid in this case. > > I agree. There are (rare) cases in Ada when "goto" is the right > solution, and nested "continue" can be one of them. But many coding rules frown on "goto" (with good reason, IMO). If "continue" is implemented with "goto", either the code-rule-checking tools will flag these "gotos" as violations, or the tools must be taught to tolerate "gotos" when they are used for "continue". IMO, if there is a frequent need for a "continue" construct in Ada programming, it should just be added to the language, even if this seems like shameful imitation of some other, more popular languages. That said, I don't remember ever having a need for a "continue" in my Ada programming, but perhaps this depends on one's design style and favourite coding idioms. > In fact, the goto is BETTER than the continue statement, because the > place where it's jumping to is marked with a label, .. If "continue" were added to Ada, of course it should have an optional loop-name to mark the loop being continued, as for the current "exit": exit Search_Loop when ...; continue Search_Loop when ...; -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .