PS. That also explains why the repeat loop isn't affected by deleting the last char - it's not a return so doesn't affect the placement of lines in the original list. Pete
On Sat, Feb 18, 2012 at 2:47 PM, Pete <[email protected]> wrote: > I have to say, the issue of returns in lines has always been confusing to > me. I've kinda resolved it by thinking of them as separators rather than > terminators. So if the last line in a list does not have a return, it's > still treated as a line because it's separated from the previous line by > the preceding return. Unfortunately, that analogy breaks down if you have > a return at the end of the last line since I would expect that to increase > the number of lines by 1 and the last line would be empty, but that's not > the case. There's still the same number of lines and no empty last line. > > Be that as it may, I just ran a test using the same construct as below and > I think there's something other than a return character causing the > problem. Here's the code: > > *on* mouseUp > > *put* "abc" & *return* & "def" & *return* & "ghi" into myLines > > *repeat* for each line myLine in myLines > > *answer* myLine & tab & (myLine contains *return*) > > *delete* char -1 of myLine > > *answer* myLine & tab & (myLine contains *return*) > > *end* *repeat* > > *end* mouseUp > > > The first answer returns the 3-char line contents and false. The second > answer returns the first two of the three characters and false. So it > seems to me that this type of repeat construct does not include the return > character in myLine. I'm guessing that there's some other non-visible > character in the file that is causing the problem. > > > Pete > > On Sat, Feb 18, 2012 at 2:18 PM, Peter M. Brigham, MD <[email protected]>wrote: > >> On Feb 18, 2012, at 10:57 AM, Michael Doub wrote: >> >> > ... >> > >> > on mouseUp >> > put URL "http://dl.dropbox.com/u/43797494/LiveCode/LoadLinks" into >> list >> > repeat for each line x in list >> > delete the last char of x >> > put x into StacktoLoad >> > exit repeat >> > end repeat >> > go URL StacktoLoad >> > end mouseUp >> >> Usually when using a "repeat for each line x" structure you will break >> things if you change x within the repeat structure. Interesting that in >> this case it works. However, it's a good habit to get into to put x into >> another variable and then change that, if you're using "repeat for each...". >> >> -- Peter >> >> Peter M. Brigham >> [email protected] >> http://home.comcast.net/~pmbrig >> >> >> >> _______________________________________________ >> use-livecode mailing list >> [email protected] >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/mailman/listinfo/use-livecode >> >> > > > -- > Pete > Molly's Revenge <http://www.mollysrevenge.com> > > > -- Pete Molly's Revenge <http://www.mollysrevenge.com> _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
