How do you do it??

Richard Gaskin ambassador at fourthworld.com
Sat Dec 24 12:44:49 EST 2011


dunbarx wrote:

> Why do LC (and HC for that matter) fail to process multi-line variables when using "do"?
> on mouseUp
>    --get "AA" & return & "BB"
>    get "AA"
>    repeat with y = 1 to 2
>       do "put" && it && "into temp" & y
>    end repeat
>    answer temp2
> end mouseUp
>
>
> If the variable "it" contains one line, the "do" construction
> works fine, making numbered temp variables as needed. But if I try the routine with a multi-line "it", the handler
> will not compile.

Creating an unknown number of variables is a natural fit for arrays:

on mouseUp
    get "AA" & return & "BB"
    repeat with y = 1 to 2
       put it into temp[y]
    end repeat
    answer temp[2]
end mouseUp

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv




More information about the Use-livecode mailing list