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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.85.165 with SMTP id i5mr7973550obz.42.1412383844737; Fri, 03 Oct 2014 17:50:44 -0700 (PDT) X-Received: by 10.50.164.137 with SMTP id yq9mr20378igb.16.1412383844637; Fri, 03 Oct 2014 17:50:44 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h18no1366657igc.0!news-out.google.com!bc9ni13481igb.0!nntp.google.com!h18no1366650igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 3 Oct 2014 17:50:44 -0700 (PDT) In-Reply-To: <3ffbdc6a-e767-4de1-922f-c9c1ec748f4d@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=97.117.195.220; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG NNTP-Posting-Host: 97.117.195.220 References: <3ffbdc6a-e767-4de1-922f-c9c1ec748f4d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: array of string From: Jerry Injection-Date: Sat, 04 Oct 2014 00:50:44 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:22059 Date: 2014-10-03T17:50:44-07:00 List-Id: On Friday, October 3, 2014 4:29:15 PM UTC-7, Stribor40 wrote: > is there way to declare array of strings to contain something like this.. >=20 > a(1)=3D"london" >=20 > a(2)""toronto" >=20 > how would i create this? The two examples you give, london and toronto, are of different lengths. Th= e elememts of an array have to be the same (or compatible *) type(s), so yo= u would have to make the strings the same length and then waste some of the= length for shorter names, and hope that you have declared the string lengt= h long enough for your longest city name. A better way is to make an array of unbounded strings whereby Ada things ea= ch element of the array is the same (an unbounded string) but yet unbounded= strings can be of any length. The only thing you'll have to watch out for = is that it is likely that other places will expect to see string, not unbou= nded string, for example, Put. This is easy as Ada provides conversion func= tions between strings and unbounded strings. When I was first learning Ada (still am, really), learning about the three = different kinds of strings was one of the most useful things to know. Anoth= er was to understand subtypes *. Jerry