From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 27 Oct 92 15:47:42 GMT From: pa.dec.com!nntpd2.cxo.dec.com!shodha!wallace@decwrl.dec.com (Richard Wal lace) Subject: help with Ada question Message-ID: <1992Oct27.154742.12210@nntpd2.cxo.dec.com> List-Id: wallace@shodha (Richard Wallace) writes: : wallace@shodha (Richard Wallace) writes: : : rwalker@barnacle.micro.umn.edu (robert walker) writes: : : : : : : If neither an exit nor a goto statement were available for Ada, how : : : might you simulate the action of an exit statement? : : : : : : : The following is one of may ways to control loop itteration without the : : exit and goto verbs. Note that I've only shown monotonicly increasing : : loop control. : : : : You would have to introduce a guard action on the loop control statement an d : : use an if to control skipping statements thus: : : : : It seems I wiped-out the other half of my emacs buffer! Sorry! I'll : reconstruct the code fragment again. : : code fragment: : It seems my mailer is having problems... I saved this file out and what got posted is truncated. Hmm... I'll try ONE more time. LOOP_COUNTER := 1; LOOP_EXIT := false; MAIN_LOOP: while ( not( LOOP_EXIT) and ( LOOP_COUNTER <= LOOP_MAXIMUM ) ) then {do statements} if {boolean clause} then LOOP_EXIT := true; -- setup for a psudeo exit end if; if not( LOOP_EXIT ) then -- psuedo exit statment in this guard. {do statements if guard is true, i.e. no exit statement} end if; LOOP_COUNTER := LOOP_COUNTER + 1; end loop MAIN_LOOP; This is one of many solutions. I hope this helps. Note that this is a monotonically incrementing loop. To do the reverse clause you'd have to count down. To change the increment you'd have to change the constant 1 in the LOOP_COUNTER assignment. Aloha, Richard -------------- Richard Wallace Senior Software Engineer Digital Equipment Corporation 301 Rockrimmon Blvd. South CXO2-1/7A Colorado Springs, CO 80919-2398 (719)548-2792 "The opinions expresses are my own, B.P. may not *quite* agree..."