MQL4 Reference Language Basics Functions Function Call
Function CallIf a name that has not been described before, appears in the expression and is followed by the left parenthesis, it is contextually considered as the name of a function.
Arguments (formal parameters) are passed by value, i.e. each expression x1,..., xn is calculated, and the value is passed to the function. The order of expressions calculation and the order of values loading are not guaranteed. During the execution, the system checks the number and type of arguments passed to the function. Such way of addressing to the function is called a value call. Function call is an expression, the value of which is the value returned by the function. The function type described above must correspond with the type of the return value. The function can be declared or described in any part of the program on the global scope, i.e., outside other functions. The function cannot be declared or described inside of another function. Examples:
At calling of a function with default parameters, the list of parameters to be passed can be limited, but not before the first default parameter. Examples:
When calling a function, one may not skip parameters, even those having default values:
Use of several functions of the same name from different execution contexts in a program may cause ambiguity. To avoid the ambiguity of function calls, always explicitly specify the function scope using scope resolution operation. See also Overload, Virtual Functions, Polymorphism |