Errors, bugs, questions - page 2641
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
There is such an advisor. It throws an error
If you comment out continue, it's fine. Am I the only one who thinks this is weird?
There is such an advisor. It throws an error
If you comment out continue, it's fine. Am I the only one who thinks it is strange?
If a function is not declared as void, it must return a value:
The only way out of this function is through i==100. Why does he think that the appearance of continue leads to an additional exit from the function?
Single or multiple output is not important. The important thing is that YOU declared a function with a type other than void - which means that the function MUST return a value.
The function and returns a value
This is the only way out of the function. That is, the only place where it has to return a value. And the C/C++ compiler agrees with me. If MQL still has its own standards on this, why does it build normally if continue is removed?
The function and returns a value
This is the only way out of the function. That is, the only place where it has to return a value. And the C/C++ compiler agrees with me. If MQL still has its own standards on this, why does it build normally if continue is removed?
The compiler doesn't know if the loop will be processed and if the code will reach return; Therefore, it requires a safety feature.
The compiler does not know if the loop will be processed and if code execution will reach return; that's why it requires a safety precaution.
The C/C++ compiler knows this perfectly well. The MQL compiler is based on one of the C/C++ compilers, as I understand it. But then again, even if it has its own logic, why does it know without continue, but with continue this knowledge is gone?
The C/C++ compiler knows this perfectly well. The MQL compiler is based on one of the C/C++ compilers, as I understand it. But then again, even if it has its own logic, why does it know without continue, but with continue this knowledge is gone?
Probably because only a person at first glance looks at such code
can figure out what is going to happen without thinking. In my opinion, it should be C and C++, not MQL. It is mql that protects against such accidental mistakes.The function and returns a value
This is the only way out of the function. That is, the only place where it has to return a value. And the C/C++ compiler agrees with me. If MQL still has its own standards in this regard, why does it build normally if continue is removed?
This function of yours is a bug. If i==100, the next check for the same i==100 will not work. And you will get an infinite loop.