From: Ted Dennison <dennison@telepath.com>
Subject: Re: Trivial Ada question
Date: Fri, 28 Jun 2002 11:44:12 GMT
Date: 2002-06-28T11:44:12+00:00 [thread overview]
Message-ID: <3D1C4BC9.5010504@telepath.com> (raw)
In-Reply-To: afhffb$pil$1@dolly.uninett.no
Reinert Korsnes wrote:
> Yes, maybe the simplest possible.
> The example below is also somehow simple,
> but I hoped for some "exit name" solution
> which I have not yet noticed :-)
>
> reinert
>
> All_OK := 1;
(0 changed to 1)
> for I in A'Range loop
> if not some condition (I) then
> All_OK := 0;
(1 changed to 0)
> exit;
> end if;
> end loop;
> N := N + All_OK;
Hmmmm. How about:
function All_Some_Condition (A : Some_Array; N : Natural) return Natural is
begin
for I in A'range loop
if not some condition A(I) then
return N;
end loop;
end loop;
return N + 1;
end All_Some_Condition;
(Warning: Not compiled. A'range may need to be A'first..A'last, I always
get those mixed up)
next prev parent reply other threads:[~2002-06-28 11:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-28 9:07 Trivial Ada question Reinert Korsnes
2002-06-28 10:10 ` David C. Hoos, Sr.
2002-06-28 10:54 ` Reinert Korsnes
2002-06-28 10:57 ` Reinert Korsnes
2002-06-28 11:33 ` David C. Hoos, Sr.
2002-06-28 11:44 ` Ted Dennison [this message]
2002-06-28 21:38 ` Steven Deller
2002-06-28 12:29 ` Steve Sangwine
2002-07-03 18:59 ` Robert I. Eachus
2002-07-03 19:41 ` Darren New
2002-07-04 8:28 ` Lutz Donnerhacke
-- strict thread matches above, loose matches on Subject: below --
2002-07-04 8:59 Grein, Christoph
2002-07-04 9:15 ` Lutz Donnerhacke
2002-07-05 22:25 ` Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox