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,2acb7591d4833271 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: loop step function Date: 1997/01/29 Message-ID: <32EF6187.3F54BC7E@escmail.orl.lmco.com>#1/1 X-Deja-AN: 213191418 references: <32E93C0B.36A@cloud9.net> <1997Jan24.192209.1@eisner> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Information Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (X11; I; SunOS 4.1.3_U1 sun4m) Date: 1997-01-29T00:00:00+00:00 List-Id: Larry Kilgallen wrote: > > In article <32E93C0B.36A@cloud9.net>, Paul Van Bellinghen writes: > > I'm fairly new to ADA. I have coded in PASCAL, FORTRAN, C, and assembly ... > > seems to be an obvious omission in the ADA language. The FOR loop does > > not have a "STEP" option. In order to perform a loop function using a > > variable's range of values but in steps greater than the variable > > kernel, you seem to have to use a WHILE loop with the variable > > incremented within the loop by the step size. Is there a more elegant ... > As regards FOR loops, you could say: > > for BY_ONE from 1 to 20 loop > declare > USEFUL_VALUE : INTEGER := BY_ONE*2; > begin > my_procedure ( USEFUL_VALUE ); > end; > end loop; Wouldn't that allocate and deallocate stack space in a loop? Yuck. Why not just replace - my_procedure ( USEFUL_VALUE ); with my_procedure ( USEFUL_VALUE*2 ); In this case, though, the newbie may be right. The while loop is liable to be more efficient -- T.E.D. | Work - mailto:dennison@escmail.orl.lmco.com | | Home - mailto:dennison@iag.net | | URL - http://www.iag.net/~dennison |