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,453ed54f02292eea X-Google-Attributes: gid103376,public From: John English Subject: Re: Simple Ada question Date: 2000/05/18 Message-ID: <3923B647.82A765D4@bton.ac.uk>#1/1 X-Deja-AN: 624911421 Content-Transfer-Encoding: 7bit References: <8f8fm5$de5$1@news.uit.no> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@bton.ac.uk X-Trace: saturn.bton.ac.uk 958641823 29741 193.62.183.204 (18 May 2000 09:23:43 GMT) Organization: University of Brighton Mime-Version: 1.0 NNTP-Posting-Date: 18 May 2000 09:23:43 GMT Newsgroups: comp.lang.ada Date: 2000-05-18T09:23:43+00:00 List-Id: Robert A Duff wrote: > > reinert@ola.npolar.no (Reinert Korsnes) writes: > > > n,I : Integer; > >... > > for I in 1 .. 10_000_000 loop > > > Why it says "I is never assigned a value" ? > > You have two different I's. The first one is never assigned a value, > and not used in any way. The 'for' loop declares a new I, which hides > the outer I. I've seen enough students fall over this one that I wonder if a compiler warning should be issued if the loop index has the same name as a variable in the enclosing scope... ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.it.bton.ac.uk/staff/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------