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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2cb6c27047140e0 X-Google-Attributes: gid103376,public From: "Robert T. Sagris" Subject: Re: How to implement a continue statement in Ada? Date: 1998/08/31 Message-ID: <35EB6C10.D85EBCF2@physics.purdue.edu>#1/1 X-Deja-AN: 386755594 Content-Transfer-Encoding: 7bit References: <35EA8153.7BFC91E3@physics.purdue.edu> Content-Type: text/plain; charset=us-ascii Organization: Purdue University Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-08-31T00:00:00+00:00 List-Id: Robert I. Eachus wrote: > > In article <35EA8153.7BFC91E3@physics.purdue.edu> "Robert T. Sagris" writes: > > > I was wondering if there is a general way of implementing > > the behavior of C's continue statement in Ada. > > No, there are several techniques, but nothing which really covers > everything. > > > If at all possible without using a goto statement. > > Well, that works in all cases, but certainly is not the best in all > cases. > > > Basically what I am asking: > > > Is there a way to skip the current iteration of a loop > > but continue with the normal progression of the loop. > > > In C, I could write: > > > i = 0; > > while (i < 10) { > > > if (a[i] == 0) { > > i++; > > continue; > > } > > > a[i] = x / a[i]; > > i++; > > } > > Ouch! Assuming that "i" really is an iteration counter; > > for I in 0 .. 9 loop > if A(I) /= 0 > then A(I) := X / A(I); > end if; > end loop; > > Seems like the natural translation, but I'm not sure that > answers your question. > -- > > Robert I. Eachus > > with Standard_Disclaimer; > use Standard_Disclaimer; > function Message (Text: in Clever_Ideas) return Better_Ideas is... It seems that people have mistaken my code example for the specific instance were I needed a continue statement. I only gave it so there was an example of a C use of the continue statement. What I was asking; how would implement the code given, which realy is just a general example, in Ada. Specifically so you could use it any any loop were you needed to skip an iteration. Thanks for the answers so far. Robbi Sagris