repeat with i=

Keith Clarke keith.clarke at clarkeandclarke.co.uk
Thu Jul 14 11:19:08 EDT 2011


Ronald, 
Sorry, don't use my first attempt - it had an error. You'd need the updated version that used itemoffset to delete the the specific number in the list, rather than it's position.
To see what was used in each loop in real time, you can either put y or answer y
To see the choices made retrospectively, just put y and CR after tSelected within the loop before the end repeat and then use answer tSelected or put tSelected after the end repeat.
Best,
Keith.. 
 
On 14 Jul 2011, at 16:06, Ronald Zellner wrote:

> Jim's seems to be the most efficient and accurate,
> but I needed this change to make it work. ' of '  changed to 'in'
> 
> I like to add something to create quick feedback- like the field "chosen".
> Easier to see the result.
> Then switch to the complete function when the code is working.
> 
> on mouseUp
>   local  Y, theNums
>   put empty into field "chosen"
> 
> put "1,2,3,4,5,6" into theNums
> sort  items of theNums numeric by random(1000000)
> repeat for each item Y in theNums
>    put Y & return after field "chosen"
> end repeat
> end mouseUp
> 
> 
> This is a variant to Keith's:
> It stops at 6 items, but it still has the problem of repeating some numbers that are still in the list.
> 
> on mouseUp
>   local x, y, z
>   put empty into field "chosen"
>   put "1,2,3,4,5,6" into x
> repeat with z = 1 to 6   
> 	put any item of x into y
> 	put y & return after field "chosen"
> 	delete item y of x
> end repeat
> end mouseUp
> 
> Ron
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list