comp.lang.ada
 help / color / mirror / Atom feed
From: John English <je@bton.ac.uk>
Subject: Re: Simple Ada question
Date: 2000/05/18
Date: 2000-05-18T09:23:43+00:00	[thread overview]
Message-ID: <3923B647.82A765D4@bton.ac.uk> (raw)
In-Reply-To: wccn1lq5x0d.fsf@world.std.com

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
-----------------------------------------------------------------




  reply	other threads:[~2000-05-18  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8f8fm5$de5$1@news.uit.no>
2000-05-16  0:00 ` Simple Ada question Gisle S�lensminde
2000-05-16  0:00 ` Jeff Carter
2000-05-16  0:00 ` Robert A Duff
2000-05-18  0:00   ` John English [this message]
2000-05-21  0:00     ` Robert Dewar
     [not found]       ` <Pine.A41.3.96-heb-2.07.1000521193502.30412B-100000@pluto.mscc.huji.ac.il>
2000-05-22  0:00         ` John English
2000-05-22  0:00           ` Ehud Lamm
2000-05-22  0:00           ` David C. Hoos, Sr.
2000-05-16  0:00 ` tmoran
replies disabled

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