Mystery with arrays (lost key)
Tariel Gogoberidze
PMDA at earthlink.net
Wed Apr 10 23:47:01 EDT 2002
> From: Dave Cragg <dcragg at lacscentre.co.uk>
> Subject: Re: Mystery with arrays (lost key)
> >on mouseUp
> > IF 1=2 THEN
> > put 1 into test2
> > else
> > put 55 into GrandTotals[test1]
> > put 66 into GrandTotals[test2]
> > put 22 into GrandTotals[test3]
> > end if
> >
> > put keys (GrandTotals)
> >end mouseUp
>
> The poster (T.G.) seemed surprised that test2 wasn't a valid key
Actually, I was little surprised that variable test2 was processed in
this if/else control structure.
on mouseup
if 1=2 then
put 1 into atest
end if
if atest is an integer then beep
end mouseup
no beep of course
I expected the similar behavior in example with arrays.
Additionally, what bothered me is that if variable test2 WAS executed
then why put key() returned empty and not it's value = 1 as in Andu's example
on mouseUp
put 1 into test2
put 55 into GrandTotals[test1]
put 66 into GrandTotals[test2]
put 22 into GrandTotals[test3]
end if
put keys (GrandTotals)
-- returns
--
1
test1
test3
-
end mouseUp
Best regards
Tariel Gogoberidze
More information about the metacard
mailing list