I've recently encountered an obstacle I somehow can't seem to get past. I want to check which of two values that is closest to a defined value.
So I have two variables, which are dynamic, so I am using this:
So basically, the values of var1 and var2 can range within 10 and 50, so if it's as low as 10, the check value would be ~0,47. So in the case, if var1 and var2 has the check values: 0,47 and 1,1 I want the condition to return false, as var2 had the value 1,1 which proves that it was closest to 21 (1,1 is about 23).
There is probably a ridiculously easy way to do this, but I just couldn't find any ways to do it.
I appreciate it! Thanks in advance.
So I have two variables, which are dynamic, so I am using this:
Code:
var1 /= 21 ; var2 /= 21 # splits both on 21
# here I want to call a condition to return a boolean true if var1 is closer to 21 than var2, false if not
There is probably a ridiculously easy way to do this, but I just couldn't find any ways to do it.
I appreciate it! Thanks in advance.