I think that is just saying, you can have parameters in both kinds of functions, and that a non value returning function returns like this
return;
as for calling a function, that is just the correct terminology for as you said, using a function, because to use a function you make a function call.
When it says no other format is provided to call to a function that doesnt return values, you are confusing calling a function with defining a function.
void Non-ReturningFunction()
that is to define a function:
void non_returning_function() { Print("all this function does is print this"); return; }
the function call looks like this:
non_returning_function();
so everytime you make that function call it will do the Print()
void Non-ReturningFunction()
that is to define a function:
void non_returning_function() { Print("all this function does is print this"); return; }
Hi SDC,
This is just a matter of semantics then.
However in the example above that is a 'non_returning_function' you have a 'return()' statement ending the function. This is a void function, so...??? Does one have to use a return() statement (to end the function?) even for a void function?
Thanks and well explained. (< 8)
However in the example above that is a 'non_returning_function' you have a 'return()' statement ending the function. This is a void function, so...??? Does one have to use a return() statement (to end the function?) even for a void function?
an example of that in practice:
void lazy_wednesday_function() { if(DayOfWeek() == 3) { Alert("Today is Wednesday so you can go back to bed :) "); return; //you could exit function here when no further processing is neccessary } else { Alert("Today is not Wednesday so get to work !! "); } return; //as Raptor said you dont need this final return. } //because the same thing will happen either wayI usually put the final return; there just because it clearly shows the logical end to the function but thats just personal preference.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In the following MQ info, I don't see any difference in the Functions other than the last variable/argument is different. Other than that the Format and Structure are EXACTLY the same are they not? I know that one can use the void Non-ReturnFunction (a,b,c) Likewise returning: return() [and return(empty)?] are for all intents and purposes are ''Non-Returning' functions' are they not?
As for 'calling' a function(), the 'calling' part and usage of 'calling' a function() is a moot point and superfluous is it not? It the same thing as just 'using' a function isn't it?
====================================================================================
The called functions are divided into two groups: those that return a certain value of a predefined type and those that don't return any value.
Format of Non-Return Function Call
A call for a function that does not return any value can only be composed as a separate operator. The call function operator is ended in ";" (semicolon):
No other format (technique) is provided to call to functions that don't return any values. <<=-This is definitely NOT true: void Non-ReturningFunction();
Format of Return Function Call
A call to a function that returns a value can be composed as a separate operator or it can be used in the program code at places where a value of a certain type is implied.
If the function call is composed as a separate operator, it ends in ";" (semicolon): <<=- Just like the Non-ReturningFunction(); So ???
Execution Rule of Function Call
The use of function calls in other operators is determined by the format of these operators.
====================================================================================
This is a very important programming distinction to have to know and use!
So what am I missing here?