repeat with i=

Jim Ault jimaultwins at yahoo.com
Thu Jul 14 03:23:15 EDT 2011


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

> ...so for a random selection, enforcing the use of all 6 items,  
> would this work?
>
> put "1,2,3,4,5,6" into x
> repeat until x is empty
> 	put any item of x into y
> 	do something
> 	delete item y from x
> end repeat
>
>

No, since the first pass could choose '2',
then the next pass could choose '6'
and produce the error "item 6 does not exist.

My preference would be to do the

  put "1,2,3,4,5,6" into theNums
  sort  items of theNums numeric by random(1000000)
repeat for each item Y of theNums
       do "some command" & Y
end repeat


Jim Ault
Las Vegas






More information about the use-livecode mailing list