Page 2 of 2

Posted: Sun Aug 16, 2009 5:21 pm
by SparkOut
Daross wrote:A question; what is aLine?
It's a variable name to hold the data for each line in turn as it loops through the text.

Take a simpler example where

Code: Select all

repeat for each line aLine in tText
    put item 2 of aLine & cr after field "DestinationListField" 
end repeat
and say tText holds

Code: Select all

Line 1,Cat,Some more data
Line 2,Dog,Extra info
Line 3,Fish,Who knows what else?
Line 4,Wildebeest,Hey - isn't that the same as a gnu?
We could say something like:
"repeat for each line [[and we're going to have a variable name here that we have called "aLine" to hold the value concerned each time we go through the loop, otherwise how will our routine know what to do with any of the data?]] in tText"
When the loop is started, the first time around it will put "Line 1,Cat,Some more data" into the variable aLine. Then item 2 of aLine will be "Cat" and it will put that into the destination field. Next time around the loop it will put "Line 2,Dog,Extra info" into aLine, and put item 2: "Dog" on the next line after the destination field. etc. etc.

You can loop though all sorts of containers in the same way, such as

Code: Select all

repeat for each item theItemVariable in aLine
also nesting the loops if you need to.

I hope that makes it clearer.

Posted: Mon Aug 17, 2009 3:55 pm
by Daross
SparkOut,

now everything is clear, thanks