control scructure repeat and next line

hershrev hershbp at realtorsgroup.us
Tue Feb 17 13:41:25 EST 2004


On Tuesday, February 17, 2004, at 01:09 AM, Sarah Reichelt wrote:

>> 1) the repeat structure  I want to do a repeat till the end of a list 
>> or end of file ? I did relies the repeat for each , I don't 
>> understand the logic behind it. how to use it
>
> repeat for each line L in myList
So the "L" is a variable that automatically initializes to 1 ?
>   -- first time through, L contains line 1
>   doStuff L   -- your script for processing the line
>   -- next time through the loop, L contains line 2 and so on
> end repeat
>
>> 2) which command tells to move to the next line (and then to  "put 
>> the selectedText into myVar"), by words I "put word myWord in a 
>> repeat so it just keeps on moving. ?
> "end repeat" tells it to start the loop again and with "repeat for 
> each", it automatically goes on to the next line. By way of example, 
> here is an identical loop in a format that might seem more familiar:
>
> repeat with x = 1 to the number of lines in myList
>   put line x of myList into L
>   doStuff L
> end repeat
>
> However, "repeat for each" is MUCH faster and once you get used to the 
> construct, very easy to write.
>
>> sorry for this silly question
>> and by the way a question , why selectedText , selectedLine, don't 
>> return the same data type . The selectedLine returns the line # and 
>> the selectedText returns the text itself  , shouldn't  the 
>> seletedLine return the string of the line as well ? isn't an 
>> inconsistency ?
> They do different things. The names of the properties may seem 
> inconsistent to you, but all the chunking expressions get different 
> segments of the data and there doesn't seem to be any reason why they 
> should overlap. If you have a more precise need, then write your own 
> function that combines some of the chunking expressions to give you 
> exactly the information you want.
Thanks, hershrev
>
> Cheers,
> Sarah
> sarahr at genesearch.com.au
> http://www.troz.net/Rev/
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list