Features of the mql5 language, subtleties and tricks - page 314
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
Is there some way to choose which loop to use depending on the value of the bool variable?
something like this :-)
Interesting implementation, thanks.
That's the way to do it too:
Is there any way to choose which loop to use depending on the value of the bool variable? Inside the loops everything is the same, so I want to select the loop itself 1 time.
This option causes an error
The error occurs due to the fact that before compilation you substitute the names specified after #define with the names specified next in this directive.
That is why your variant unfolded in:
There is no loop body after the first for(), but else immediately follows. This is what is reported in the error.There is no loop body after the first for(), but else comes right after it. This is what is reported in the error.
I understand.
up ? i >= start : i < end
I didn't know that the conditional operator ? : in the 2nd and 3rd operands you can use expressions of relation operations, and I didn't realise to check it. I've been wondering for a long time how you can quickly change ">" to "<".
I didn't know that in the conditional operator ? : in the 2nd and 3rd operands you can use expressions of relation operations, but I didn't realise to check it. I've been wondering for a long time how you can quickly change ">" to "<".
Friends, please remind me, somewhere I read about constructors and destructors. The order of creation and destruction, but I can't find it....
Should a parent's constructor be called in a descendant?
Should the parent's destructor be called in the descendant?
Please show some examples, especially about destructor.
Friends, please remind me, somewhere I read about constructors and destructors. The order of creation and destruction, but I can't find it....
Should the parent's constructor be called in the descendant?
Should the parent's destructor be called in the descendant?
Please show some examples, especially about destructor.
In the descendant you must specify which of the parent's constructors is used.
class Child: public Parent {
// construct
Child(double arg):Parent() {
}
// copy cons
Child(const Child &orig):Parent(orig) {
}
~Child() {
}
}
You don't need to write or specify anything like that in destructors
Does the parent's constructor need to be called in the descendant?
Should the parent's destructor be called in the descendant?
Write this line in all constructors/destructors.
Then you will see the sequence of all calls in the log. And the picture will be formed.