Compile error: ')'. - not all control paths return a value
You don't have all branches of the code returning a value:
int f()
{
int res = 0;
while ( true ) //или for(;;)
{
//много строк c return, continue, без break
res = 0;break или continue//много строк c return, continue, без break
res = 1;break или continue
}
return(res);
}
Or like this:
int f()
{
while ( true ) //или for(;;)
{
//много строк c return, continue, без breakreturn0;
//много строк c return, continue, без breakreturn1;
}
return(значение возвращаемое по умолчанию если не выполнены предыдущее return);
}
Looked at your code more closely. You missed a mistake: the return value by the operator return should be written in brackets. return(0) but you wrote return 0;
Moreover, C++ acts as a certain model in this case.
Vitalii Ananev:
Looked at your code more closely. You missed a mistake - the return value by return operator should be written in brackets. return(0) but you wrote return 0;
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Compile error: ')'. - not all control paths return a value
You don't have all branches of the code returning a value:
Or like this:
You don't have all branches of the code returning a value.
In the example he gives, all of them. The only way to exit while(true) is with break (which he doesn't have) or return.
I'm not going to argue. But the compiler error message ')' - not all control paths return a value, says otherwise.
Try the same thing in C++
What does C++ have to do with it?
....
Looked at your code more closely. You missed a mistake: the return value by the operator return should be written in brackets. return(0) but you wrote return 0;
What does C++ have to do with it?
Looked at your code more closely. You missed a mistake - the return value by return operator should be written in brackets. return(0) but you wrote return 0;
While C++ acts as a reference in this case
So you write in C++ and compile it all in mql?
Why the extra brackets?
This is the syntax of mql language.
So you write in C++ and compile it all in mql?
This is the syntax of the mql language.
You can return a value without brackets. Just try it.
So you write in C++ and compile it all in mql?
This is the syntax of the mql language.