Is there a way for me to create a function which activates the highest return value?
Example:
public void ChooseFunction()
{
//Choose function2, as it has the highest returning value
}
float Function1 ()
{
return 1;
}
float Function2 ()
{
return 2;
}
Just to clarify, do you want ChooseFunction()
to return the highest value returned between Function1()
and Function2()
, or do you only want the function that would return the highest value to be called, and not the other?
Can use this :
float highest = ((Function1() > Function2()) ? Function1() : Function2());
Or if you want to call the function you can use something like :
public void ChooseFunction()
{
//Choose function2, as it has the highest returning value
bool oneisbigger = (Function1() > Function2())
if(oneisbigger)
Function1();
else
Function2();
}
float Function1 ()
{
return 1;
}
float Function2 ()
{
return 2;
}
void Function1(){
}
void Function2(){
}