Hi
I have ten variables and I need to check they are in order.
See below:
var1 = 1 // boolean
var2 = 1 // boolean
var3 = 1 // boolean
var4 = 1 // boolean
var5 = 1 // boolean
var6 = 1 // boolean
var7 = 1 // boolean
var8 = 1 // boolean
var9 = 1 // boolean
var10 = 1 // boolean
if (var1 >= var2) and (var2 >= var3) and (var3 >= var4) and (var4 >= var5) and (var5 >= var6) and (var6 >= var7) and (var7 >= var8) and (var8 >= var9) and (var9 >= var10) then
inorder = 1
else
inorder = 0
endif
The problem I’m having is the variables can be enabled or disabled by the user. If they are disabled, then their value is 0.
Therefore, using the above test fails if any one of them isn’t enabled.
Other than a convoluted bunch of if/ then statements, is there another way to achieve such a check?
Thanks
Rob
Can you make an example of the value they may retain and which is the order you need?
Hi Roberto
The values could be anywhere in the range say 1-2000.
If the variable values are in order (depending on which are enabled) then they are not interesting. In order is as mentioned in first post so (var1 >= var2) and (var2 >= var3) etc.
So if any of the lower ones are enabled they should always be a higher number than the higher ones.
Sometimes they get completely out of order and it would be useful to know those orders without having to check manually but I think that is too complicated. Simply knowing when they are not in the primary order would be a start.
I hope that makes sense? Let me know if not.
Many thanks
Rob