I want to call a function A that returns an int. function A calls function B, which changes some values needed by function A to correctly proceed. Something like this:
global variable value;
function A(){
// do some stuff
B();
//do some stuff
return value;
}
function B(){
//does some stuff that times time
//changes value
}
My problem is that function A returns before function B finishes. I have looked at callbacks but that doesn't seem to be what I am looking for. Is there a practical way to achieve this ? Thanks in advance.