Help me please, i need to change the returned value of a function is a new condition happens

 

Hi, i need help to code this, can someone help me to do it?


double r;

void OnTick()                                  
   {

if (test()==10)
change r value///QUESTION, how can i change return value of test function (r) to another value, if that condition happens?
 
                                   
   } 

double test () //
{

r=10; // i need to change this value, if the right criteria happens on start function

return (r);
}

Thanks for any help

Reason: