How do you do it??

dunbarx at aol.com dunbarx at aol.com
Sat Dec 24 13:01:52 EST 2011


Richard.


This returns:


AA
BB


I am sure you meant:


put line y of it into temp[y]


I thought an array would be a more compact way to do what I originally wanted to. It is a long story, but the processing needed to form the array was the same as I had to do to in ordinary variables.


I am not sure that is true, of course.


It involved my silly license plate game, which I am sure everyone is talking about, making words containing arbitrary groups of three letters.


Craig





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






-----Original Message-----
From: Richard Gaskin <ambassador at fourthworld.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Sat, Dec 24, 2011 7:47 am
Subject: Re: How do you do it??


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

_______________________________________________
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

 



More information about the Use-livecode mailing list