How do you do it??

Richard Gaskin ambassador at
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:
  Webzine for LiveCode developers:
  LiveCode Journal blog:

More information about the Use-livecode mailing list