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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,7d1a6bfc6489c17b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-09-02 15:34:42 PST Path: supernews.google.com!sn-xit-02!sn-east!supernews.com!news-feed.riddles.org.uk!freenix!wanadoo.fr!not-for-mail From: Mathias Dolidon Newsgroups: comp.lang.ada Subject: Re: exiting a bloc Date: Sun, 03 Sep 2000 00:34:57 +0200 Organization: Wanadoo, l'internet avec France Telecom Message-ID: <39B18091.7416092A@netcourrier.com> References: <39B15EA8.88DB58AB@netcourrier.com> <8orprn$b46$1@nnrp1.deja.com> NNTP-Posting-Host: mix-lyon-106-194.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: wanadoo.fr 967934064 25754 193.250.217.194 (2 Sep 2000 22:34:24 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 2 Sep 2000 22:34:24 GMT X-Mailer: Mozilla 4.7 [fr] (X11; I; Linux 2.2.14-15mdk i686) X-Accept-Language: fr, en Xref: supernews.google.com comp.lang.ada:484 Date: 2000-09-02T22:34:24+00:00 List-Id: > The obvious answer is that a goto could be used, however, it is > almost certain that if we saw the entire code we would suggest > some other method. In particular, it is not at all clear why > you are using a block at all, it appears useless but of course > we do not have your entire code. Here is the entire code : ------------------------------------------- with ada.text_io, ada.integer_text_io; use ada.text_io, ada.integer_text_io; with ada.numerics.elementary_functions; use ada.numerics.elementary_functions; procedure nbr_prem is nombre_en_cours, diviseur, racine : positive; begin put_line("-- Recherche des nombres premiers de 1 �" & positive'image(positive'last) & " --"); new_line; put_line(positive'image(1)); put_line(positive'image(2)); put_line(positive'image(3)); for nombre_en_cours in 3..positive'last loop racine := positive(sqrt(float(nombre_en_cours))) + 2; test: loop for diviseur in 2..racine loop exit test when nombre_en_cours rem diviseur = 0; end loop; put_line(positive'image(nombre_en_cours)); exit; end loop test; end loop; end nbr_prem; ---------------------------------------- You see here that I have used a loop with an unconditionnal exit to simulate a block, but I think it would be cleaner with a real block. Don't tell me about the algorithm ! This is just to try out the Ada language. Thank you Mathias