phy:
yes, for example
int function(){
if(x) return(1);
if(y) return(2);
if(z) return(3);
return(0);
}
compared to below, what is opinion on code size and speed?
it is very easy to have return()'s all over the place, which can lead to confusion - but makes for less planning and ease...
ie, some would say "one entry point and one exit point" - I grew up with this thinking but I am not so sure about it any more ;)
interesting to read peoples thoughts on this too!
int function(){
int retVal=0; //default
if(x) retVal = 1;
else
if(y) retVal = 2;
else
if(z) retVal = 3;
return(retVal);
}
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
can one have more than one retrun statement in a routine? the return statmets are nested in conditional "different scope" blocks.
thanks