comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Simple Ada question
Date: 2000/05/16
Date: 2000-05-16T00:00:00+00:00	[thread overview]
Message-ID: <wccn1lq5x0d.fsf@world.std.com> (raw)
In-Reply-To: 8f8fm5$de5$1@news.uit.no

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.

You're writing this the way you're supposed to do it in Pascal.  In Ada,
there's no need to declare the 'for' loop variable, because it's
automatically declared.  If you *do* declare a(nother) I, it will be a
completely separate variable.  If you reference the outer I after the
loop, you're refering to an uninitialized variable.

- Bob




  parent reply	other threads:[~2000-05-16  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 Jeff Carter
2000-05-16  0:00 ` Robert A Duff [this message]
2000-05-18  0:00   ` John English
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
2000-05-16  0:00 ` Gisle S�lensminde
replies disabled

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