alternative to do for loading variables from arraypp

Jim sims sims at ezpzapps.com
Sat Mar 15 23:30:29 EDT 2014


On Sunday, March 16, 2014, Kay C Lan <lan.kc.macmail at gmail.com> wrote:

> I'm not sure I understand your problem fully but I think 'repeat for each
> key' and the value() function might help.
> In the message box:
>
> put 5 into tApple  --put something into various variables
> put 50 into tBanana
> put 5000 into tCarrot
> put "tApple" into aArray[a] --build an array
> put "tBanana" into aArray[b]
> put "tCarrot" into aArray[c]
> repeat for each key tKey in aArray
>   put "tKey = " & tKey & "; Variable = " & aArray[tKey] & " = " &
> value(aArray[tKey]) & cr after msg
> end repeat
>
>
> On Sun, Mar 16, 2014 at 4:04 AM, Dr. Hawkins <dochawk at gmail.com<javascript:;>>
> wrote:
>
> > Is there a "decent" way to load variables from an array without "do" or a
> > long list of commands?
> >
> > If theList[pageName] is "cat page" and so forth, I can
> >
> > repeat for each word theVar in "pageName pageHeight pageWidth"
> >    do "put " & theList[theVar] & " into " & theVar
> > end repeat
> >
> > but this will cause a slew of compiles.
> >
> > I could also rattle off the list, but this is more maintainable.
> >
> > Is there a better way to do this?
> > --
> > Dr. Richard E. Hawkins, Esq.
> > (702) 508-8462
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com <javascript:;>
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com <javascript:;>
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Sent from my iPodo - it makes weird spelling sometimes :-P



More information about the use-livecode mailing list