put same value into multiple containers at the same time

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
churchken
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 66
Joined: Sun Apr 15, 2007 2:54 pm
Location: Albuquerque, NM USA

put same value into multiple containers at the same time

Post by churchken » Mon Apr 30, 2007 4:57 pm

Hi,

Is there a "shortcut" way to do the following with a single line of code?

Code: Select all

put "ABC" into field"myletters"
put "ABC" into field"yourletters"
Many times, the same "value" needs to be assigned to multiple variables, and it would seem logical there should be a way to do so all with one line of code. I just have not seen an example of it.

Thanks,
Ken

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Sat May 05, 2007 4:50 pm

The only way I see to do this is with a repeat loop:

Code: Select all

put "myletters,yourletters,theirletters,anotherletter" into theFields
repeat for each item theItem in theFields
  put "ABC" into field theItem
end repeat
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”