repeat with i=

Ronald Zellner zellner at tamu.edu
Thu Jul 14 11:06:01 EDT 2011


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


More information about the use-livecode mailing list