repeat with i=

Jerry J jhj at jhj.com
Thu Jul 14 18:35:40 EDT 2011


On Jul 14, 2011, at 2:12 AM, Keith Clarke wrote:

> ...ah yes, of course, thanks Jim - I forgot that 'delete item y' is not the same as 'delete item *called* y' !
> 
> So, would itemoffset help...?
> 
> put "1,2,3,4,5,6" into theNumbers
> repeat until theNumbers is empty
> 	put any item theNumbers into n
> 	do something
> 	delete (itemOffset(n, theNumbers)) from theNumbers
> end repeat

In the case of 1,2,3,4,5,6 itemOffset will work, but a warning about itemOffset:
itemOffset("2","23,24,2") returns 1 because the string "2" matches the first 2 of 23. This is not applicable to this exercise, but might save somebody some trouble. In a previous project I assumed that it looked for a matching *item*, but in fact it looks to match a *string*. Arrgh. The docs are correct, by the way.

--jhj





More information about the use-livecode mailing list