Truly delightful!
It looks like you could make a quick buck on this one!
what are you not satisfied with?
yes=1, no=0,
a<=f does not fulfil
==right answer
what are you not satisfied with?
yes=1, no=0,
a<=f is not fulfilledc
== right answer
But it does (a>=s || a<=f) && s>f
You should have put brackets
Why? || has a higher priority than &&
The answer is either correct, or it's just a very strange rule in MQL4, or the logical operations are performed by very strange rules. It doesn't look like C/C++ or anything else. I even translated it into JavaScript:
var a=23; var s=20; var f=1; // Исходное условие var r1 = a>=s && a<=f && s<=f || (a>=s || a<=f) && s>f; // Дальше пошли извращения var r2 = a>=s && a<=f && s<=f; var r3 = (a>=s || a<=f) && s>f; var r4 = r2 || r3; // Вывод WScript.Echo(String(r1)+" "+String(r2)+" "+String(r3)+" "+String(r4));Result: true false true true true
Conversely, && has a higher priority than ||
IN MQL4 ? Possibly, but it should be.
Not at all ! The "or"(||) takes precedence here - unambiguously !
If there are no parentheses, then || is executed first, and then &&
Therefore brackets must be placed in the appropriate places.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Code:
Now a question for you to ask: who is glitching me or MQL4???
Thanks:)