From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: making compare function with multiple values(help for newbie)
Date: Thu, 12 Oct 2006 14:35:29 -0400
Date: 2006-10-12T14:35:29-04:00 [thread overview]
Message-ID: <uk6354c26.fsf@stephe-leake.org> (raw)
In-Reply-To: 1160633325.255903.114880@c28g2000cwb.googlegroups.com
"isaac2004" <isaac_2004@yahoo.com> writes:
> this is the part that has the generic array
>
> FUNCTION InArray IS NEW In_Array_Generic (
> ValueType => CatType,
> IndexType => Integer,
> ArrayType => CatArrayType);
>
> that is the call to the function so it is the first choice i first get
> the 3 values with a loop
>
> FOR I IN 1..5 LOOP
> Get (Cats(I));
> END LOOP;
> where get is a function that
> Get(Cat.Id)
> Get(Cat.Age)
> Get(Cat.Lives)
>
> and the 3 values are stored into one index of the array
> i hope this helps
Get will return CatType, which is apparently a record containing the
fields ID, Age, Lives. So to compare these three values you need
something like:
FOR I IN 1..5 LOOP
if Get (Cats(I)).ID = <user_id> then
...
end if;
if Get (Cats(I)).Age = <user_age> then
...
end if;
...
END LOOP;
--
-- Stephe
prev parent reply other threads:[~2006-10-12 18:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-11 23:03 making compare function with multiple values(help for newbie) isaac2004
2006-10-12 5:36 ` Jeffrey R. Carter
2006-10-12 6:08 ` isaac2004
2006-10-12 7:24 ` Ludovic Brenta
2006-10-12 16:21 ` isaac2004
2006-10-12 18:40 ` Jeffrey R. Carter
2006-10-12 18:35 ` Stephen Leake [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