comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@escmail.orl.lmco.com>
Subject: Re: loop step function
Date: 1997/01/29
Date: 1997-01-29T00:00:00+00:00	[thread overview]
Message-ID: <32EF6187.3F54BC7E@escmail.orl.lmco.com> (raw)
In-Reply-To: 1997Jan24.192209.1@eisner


Larry Kilgallen wrote:
> 
> In article <32E93C0B.36A@cloud9.net>, Paul Van Bellinghen <pvanbell@cloud9.net> 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          |




  reply	other threads:[~1997-01-29  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-24  0:00 loop step function Paul Van Bellinghen
1997-01-25  0:00 ` Larry Kilgallen
1997-01-29  0:00   ` Ted Dennison [this message]
1997-01-30  0:00     ` Robert Dewar
1997-01-25  0:00 ` Matthew Heaney
1997-01-27  0:00   ` johnherro
1997-01-27  0:00     ` Michael Feldman
1997-01-25  0:00 ` Geert Bosch
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox