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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fe5e779eaf4ecf02 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to loop (elegant) throug a vector ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1213989682 12.201.97.213 (Fri, 20 Jun 2008 19:21:22 GMT) NNTP-Posting-Date: Fri, 20 Jun 2008 19:21:22 GMT Organization: AT&T ASP.att.net Date: Fri, 20 Jun 2008 19:21:22 GMT Xref: g2news1.google.com comp.lang.ada:788 Date: 2008-06-20T19:21:22+00:00 List-Id: Reinert Korsnes wrote: > > for k in 1 .. Positive(X.Length) loop > do_something(X.Element(k)); > end loop; > > Could anybody suggest improvements for the three > last lines in the code? for K in 1 .. X.Last_Index loop Do_Something (X.Element (K) ); end loop; Since the correct name for this package is Unbounded_Arrays, it makes sense to iterate over it in a manner to iterating over an array. -- Jeff Carter "C's solution to this [variable-sized array parameters] has real problems, and people who are complaining about safety definitely have a point." Dennis Ritchie 25