alternative to do for loading variables from array?

Phil Davis revdev at pdslabs.net
Mon Mar 17 12:23:15 EDT 2014


Another approach: If you're worried about the number of compiles, you 
could build your block of code in the repeat loop and then run it with a 
single "do" afterward. (or to work around the 10-line limit for do 
statements, build 10 lines at a time and run them, then build 10 more...)

Phil Davis


On 3/17/14, 8:33 AM, Bob Sneidar wrote:
> Why would you want to? Why not just use the array variables “as is”? What you are doing seems to me to be something like “put a into b” and then not modifying a or b.
>
> In your example, do something like:
>
> put (theList[theVar] contains “cat page”) into isTrue
>
> Bob
>
>
> On Mar 15, 2014, at 13:04 , Dr. Hawkins <dochawk at gmail.com> 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
>> 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
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

-- 
Phil Davis





More information about the use-livecode mailing list