I know that there are better ways to solve this problem, but I want to try it in a certain way to solve my problem
I want to
a.) create a list of 6 random numbers between 1 and 10
b.) these numbers should also be written in a list
c.) for every new random numbers one should look in the list for a duplicate
d.) if a duplicate is found, the duplicate item in the list is deleted, the repeat counter is subtracted with 1
e.) in the end the list is written to a text field
I am not very good in programming and LiveCode and I tried to solve it this way without success

Here is my coding attempt ... what is wrong?
Code: Select all
on mouseUp
local x, myList, z, myNumber
repeat with x = 1 to 6
## generate 6 numbers between 1 and 10
put random(10) into myNumber
## put number to a list
put myNumber into item x of myList
## every item in list in checked
repeat for each item z in myList
## no check for the first number
if x > 1 then
if (item z of volleListe) = myNumber then
## Delete the duplicat
delete item z of myList
subtract 1 from x
else
## no duplicate
put item myNumber of myList & return after field "Field"
end if
end if
end repeat
end repeat
Mike