Repeat question

DunbarX at aol.com DunbarX at aol.com
Tue May 4 18:20:52 EDT 2010


Steve;

You have several valid answers.

More important, consider a couple of the niceties in what has been said:

1- The "repeat with" structure declares a variable and sets an initial and 
a final value, incrementing automatically. In your case, you start at 
explicitly at 1 and continue until the property "the number of flds" is reached. 
This property is the total number of fields on the card, and is nice because 
even if this quantity changes, your code is still valid. That is very cool.

2- Fields have identifiers, "number" being one of the big three (with name 
and ID). Though it was mentioned that numbering can change, for your 
purposes it is sufficient to know that each field has its own number at any given 
time; the ordering does not matter in your case, each is accessed in its 
turn, and none are missed. Note that this circumvents names entirely.

3- You simply must write a few repeat loops using "repeat with". And set 
the start and end values with both explicit numbers and also with properties. 
And then you simply must write a few loops with the "repeat until condition" 
and "repeat for each...".   Check the dictionary. Nobody can live without 
repeats.

Craig Newman



More information about the use-livecode mailing list