'}' - not all control paths return a value - MetaEditor 5.00 Build 883
Forum on trading, automated trading systems and testing trading strategies
Hello,
This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.
- They are more people who can answer there.
- They are more people who can have similar problem there.
- A forum is not only to get help but to share with the community, mql4/MT4 community isn't the same as mql5/MT5 community.
Subgenius:
What is the problem causing this error message?
MetaEditor 5.00 Build 883 / MetaTrader 4 Build 604
Problem is here :
string Per(int thisperiod) { if(thisperiod==1){return("M1");} if(thisperiod==5){return("M5");} if(thisperiod==15){return("M15");} if(thisperiod==30){return("M30");} if(thisperiod==60){return("H1");} if(thisperiod==240){return("H4");} if(thisperiod==1440){return("D1");} if(thisperiod==10080){return("W1");} if(thisperiod==43200){return("MN1");} returned value ? }
You declare a function which should return a string, but what if all "if" are false ?
angevoyageur:
By the way, maybe Subgenius must literally switch to a switch case statement (https://www.mql5.com/en/docs/basis/operators/switch) and use default label.
Problem is here :
You declare a function which should return a string, but what if all "if" are false ?
Documentation on MQL5: Language Basics / Operators / Switch Operator
- www.mql5.com
Language Basics / Operators / Switch Operator - Documentation on MQL5
What is the problem causing this error message?
MetaEditor 5.00 Build 883 / MetaTrader 4 Build 604