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: dewarr@my-dejanews.com Subject: Re: How to implement a continue statement in Ada? Date: 1998/09/01 Message-ID: <6sfm15$39s$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 386659478 References: <35EA816A.E11FEA85@physics.purdue.edu> X-Http-Proxy: 1.0 x11.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Sep 01 02:26:45 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-09-01T00:00:00+00:00 List-Id: In article <35EA816A.E11FEA85@physics.purdue.edu>, "Robert T. Sagris" wrote: > I was wondering if there is a general way of implementing > the behavior of C's continue statement in Ada. > > If at all possible without using a goto statement. > > 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++; > } > > Thanks for any information you can give me. > > Robbi Sagris > The only general way of implementing a continue is to use a goto. Use a stylized approach like This_Loop : loop ... if ... then goto Continue_This_Loop; end if; ... ... <> null; end loop This_Loop; This works fine, unless you have some inexplicable allergy to typing G-O-T-O :-) See the archives for a recent discussion of the use of gotos for this purpose. -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum