Repeat variable name changing

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Mar 8 08:34:27 EST 2008


Hi Jim,

Le 8 mars 08 à 14:27, Jim Hamlyn a écrit :

> Hi Folks,
>
> Sorry for the basic question – I just can’t seem to find a solution  
> in the
> documentation. I’m trying to change the name of a variable on the  
> fly during
> a repeat loop eg:
>
>  repeat with tCount = 1 to the number of lines in fld "myField"
> Here I’d like myVariable1 to increment/iterate the last character  
> (number)
> of its name for each loop of the repeat
>
> How is this done?
>
> Many Thanks in advance
>
> Jim Hamlyn

You have two ways to handle this and one is more elegant: you'll  
choose :-)

put 1 into myVariable1
repeat with tCount = 1 to the number of lines in fld "myField"
   <doMyStuff>
   add 1 to myVariable1
end repeat

Or:

repeat with tCount = 1 to the number of lines in fld "myField"
   -- use tCount directly here: this will need probably to use a 'do'  
command as:
   -- do "put foo into myVariable" & tCount
end repeat

Could probably help more with more details about what you want to  
achieve.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list