Download MetaTrader 5
To add comments, please log in or register
Do you want to write a technical indicator? Find solution in MQL5 Reference!
Yochanan Gerbi
Yochanan Gerbi 2014.12.29 15:08 

Hello friends,

I want to share with you my thoughts:

I can see different way of using the RETURN operator: 

I understand bool/double/int/string functions that returns a value.

BUT why void function uses RETURN or RETURN(0)? 

What it the diffidence? 


honest_knave 2014.12.29 15:36  

You don't have to use return anywhere in a void function. Once the code is complete, it will 'return' by itself.

If you want the void function to end prematurely, then return is useful.

if(condition) { return; }


If you try to use return(0) on a void function, you should get an error or a warning (depending on whether #property strict is used)

To add comments, please log in or register