What's the best way to find the highest value out of 5 variables? I know you can do this:
Note: I know that won't work, it's just because I typed it in my browser and I'm to lazy to make a longer version (It may work, but it would most likely just scan till ONE is higher then stop, I need the find the highest
But it's to messy. Any other ways?
Code:
Int Highest = Var1;
If(Highest < Var1) {
Highest = Var1;
} else if(Highest < Var2) {
Highest = Var2;
} else if(Highest < Var3) {
Highest = Var3;
} else if(Highest < Var4) {
Highest = Var4;
} else if(Highest < var5) {
Highest = Var5;
}
Note: I know that won't work, it's just because I typed it in my browser and I'm to lazy to make a longer version (It may work, but it would most likely just scan till ONE is higher then stop, I need the find the highest
But it's to messy. Any other ways?