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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fe8fca999e54f9fe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-19 18:23:50 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: how to create an array of N elements? Date: Mon, 19 Aug 2002 18:28:47 -0700 Organization: AdaWorks Software Engineering Message-ID: <3D619B4F.9551C98D@adaworks.com> References: <3D5E76C3.1070005@cogeco.ca> Reply-To: richard@adaworks.com NNTP-Posting-Host: 3f.bb.81.41 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 20 Aug 2002 01:23:49 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:28232 Date: 2002-08-20T01:23:49+00:00 List-Id: drmed wrote: > thank you. > > then an other question: > > list : unbounded_string; > type page is array(Positive range <>) of list; > text : page(1 .. 300); > > but how can I change the number of elements in runtime? for example I > delete a element of the array text or add one so that the array text > now has only 200 elements and really only 200 elements and not contain > a null string. Consider using a declare block. For example, with ada.integer_text_io; procedure Dynamic_Array is Size : Positive := 300; begin ada.integer_text_io.get(size); Variable_Size_Array_Block: declare S : String(1..Size); begin for I in S'Range loop null; end loop; end Variable_Size_Array_Block; end Dynamic_Array; Many Ada developers will recommend a better approach such as nesting a subprogram in the declarations of the enclosing unit and passing the new size as a parameter. Either way, you can accomodate variable size array declarations in your program if you need them. Richard Riehle