comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Simple Ada question
Date: 2000/05/16
Date: 2000-05-16T00:00:00+00:00	[thread overview]
Message-ID: <DofU4.337$BR3.219206@news.pacbell.net> (raw)
In-Reply-To: 8f8fm5$de5$1@news.uit.no

>test1.adb:8:06: warning: "I" is never assigned a value

Line 8 of the program is
   n,I : Integer;
and in column 6 we see the variable I defined.  It is never used
in the rest of the program.

  Probably you are confused because some programming languages
would require this declaration of I and would use that I in the loop
       for I in 1 .. 10_000_000 loop
whereas in Ada the loop variable is a brand new one, automatically
created, in this case with the name I.  eg,

       for I in 1 .. 10_000_000 loop
         ...
       end loop;

acts like:

   declare
       I : Integer;
   begin
       for I in 1 .. 10_000_000 loop
         ...
       end loop;
   end;

So you can drop the declaration of "I" on line 8.




      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 Gisle S�lensminde
2000-05-16  0:00 ` Robert A Duff
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 ` Jeff Carter
2000-05-16  0:00 ` tmoran [this message]
replies disabled

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