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: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: How to implement a continue statement in Ada? Date: 1998/08/31 Message-ID: #1/1 X-Deja-AN: 386582334 References: <35EA8153.7BFC91E3@physics.purdue.edu> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-08-31T00:00:00+00:00 List-Id: 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...