Either use global variables (those you declare above Start())
or use by reference parameters.
https://docs.mql4.com/basis/variables/formal - see 3rd example
Either use global variables (those you declare above Start())
or use by reference parameters.
https://docs.mql4.com/basis/variables/formal - see 3rd example
msbusinessil :
Either use global variables (those you declare above Start())
or use by reference parameters.
https://docs.mql4.com/basis/variables/formal - see 3rd example
i dont get it, pls help me i am newbie learning MQL.
example :
int this_function(){
x= 4;
y=5;
z=6;
return(x);
}
======
int get value = this_function();
=============From Above code. how?
When you pass parameters by reference (note the "&" before each parameter in func declaration) you actually pass their address in memory. So when you make changes to them inside a function, you are changing the original value of the passed variables.
You can't use "return" to return more then 1 value.
void start() { double A,B,C; func(A,B,C); Print(A,B,C); //Result: 456 } void func(double& x, double& y, double& z) { x = 4; y = 5; z = 6; }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
As we know that we can return what we need from function. can anyone show me how to return 2 or more value from the function and pass it to out side function?
Thanks.