Looping over all buttons

Ken Ray kray at sonsothunder.com
Thu Feb 23 13:02:54 EST 2012


On Feb 22, 2012, at 11:51 AM, Bob Sneidar wrote:

> I am constantly doing do! Don't you?

I used to use "do" a lot more than I do now… for example, if you have 12 fields named "MyField1" through "MyField12", instead of using:

repeat with x = 1 to 12
  do "put" && quote & "Hello" & quote && "into field" && quote & "MyField" & x & quote
end repeat

you can use this instead:

repeat with x = 1 to 12
  put "Hello" into field ("MyField" & x)
end repeat

It's a lot easier and doesn't bog down processing like using "do" does. There are definitely certain cases where you need to use "do", but this isn't one of them. 


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list