Download MetaTrader 5

hides global declaration warnings

To add comments, please log in or register
Jiayu Fu
1268
Jiayu Fu  

i often create function that hides global declarations, there somehow to avoid this problem ?

i need to create several function that catch the same variable of the onstart(),

to code it faster and easy to read i desire that all my functions have the same name but its another declaration, so i get the warning

i found in Internet that it is possible in other language like swift that you need to put #someInteger in the function to refer that it's same name.

it is possible use the same name in the function and the global avoiding problems?

problem example code: 

int someFunction(int someInteger)
 {
  int someAnotherInteger = someInteger+5;
  return(someAnotherInteger;
}
//-------------------------------------++
int someAnotherFunction(int someInteger)
 {
  int someAnotherInteger = someInteger-20;
  return(someAnotherInteger;
}
//-------------------------------------++
OnStart()
   {
int someInteger=0;

someFunction(someInteger);

someAnotherFunction(someInteger);
}
Stuart Browne
6034
Stuart Browne  
Aeither:

i often create function that hides global declarations, there somehow to avoid this problem ?

i need to create several function that catch the same variable of the onstart(),

to code it faster and easy to read i desire that all my functions have the same name but its another declaration, so i get the warning

i found in Internet that it is possible in other language like swift that you need to put #someInteger in the function to refer that it's same name.

it is possible use the same name in the function and the global avoiding problems?

problem example code: 

No, you can't do what you're describing in mql. You need to rename the parameters. Also, your calling functions with a return value. You're mixing up void and int functions.
To add comments, please log in or register