I'm pretty sure I'm missing something, but I can't figure out what it is.
It's a really simple code, self explanatory I guess:
So what I need the code to do is to find a median out of 3 and just in case 2 or all of them are the same assign median to a certain one.
It all works well untill I set all 3 to one big number, for example 100, then switch one of the variables to x<100. After that the whole project seems to freeze. It will keep showing me x, no matter what numbers I choose on no matter what variable, even if I change all 3 of them to random numbers.
Offline
I would probably do it using a list variable, this way:
Delete all from templist
Add var1 to templist
if var2 > var1
Add var2 to templist
else
Insert var2 at 1 of templist
if var3 > item 2 of templist
Add var3 to templist
else
if var3 < item 1 of templist
insert var3 at 1 of templist
else
insert var3 at 2 of templist
set med to item 2 of templist
Last edited by BoltBait (2009-09-09 15:45:10)
Offline