So it's easy to see why,
If you Print() it,you will see the "(6 && 7)" will return true,So true means 1 in Boolean logic,(false is 0)
So the second condition is always false,because 1 is not bigger than 5,
So if you change it to 0 as below:
if( (6 && 7) >0) // Works now Print("PARENTHESIS Yes");It will work as intended,
So it's easy to see why,
If you Print() it,you will see the "(6 && 7)" will return true,So true means 1 in Boolean logic,(false is 0)
So the second condition is always false,because 1 is not bigger than 5,
So if you change it to 0 as below:
It will work as intended,Print("6 && 7 ", 6 && 7); Print( "(6 && 7) " ,(6 && 7) );
Both are TRUE which would mean they are both one.
Then why does
if( 6 && 7 >5) Print("Yes");
work while the other one , which also means 1, doesnt?
I take it that its because its 6 whatever is true and then 7 is greater than five is also true.
However, I want to compare both 6 to 5 and also 7 to 5 without needing to do
if( 6>5 && 7>5)
Is there a way to compare correctly for example
if( 3>5 && 4>5 && 6>5 && 7>5 && 8>5)
Without needing to compare every single one of them to the 5, so that its sometething like all of them together compared to five?
I thought that
if( 3>5 && 4>5 && 6>5 && 7>5 && 8>5) could be substituted all of the individual comparisons to five like this: if( (3 && 4 && 5 && 6 && 7 && 8) > 5 )
So i don't have to individually compare them all to five; you understand?
Anything like that available in mql4? Not using arrays or stuff like that; what I need is a simple syntax solution for this nothing complicated. Trying out all that occurs to me, so as to not have to repeat the >5 every single time for say 100 different numbers
A little weird to explain "cause my view is off".
Its essentially ON THE FLY creating a group of values through simple syntax way (no arrays), and then compare every individual unit of the group to 5.
The way I know how to do this involves arrays and for loops. Isn't there a simpler way?
Still can't decipher how exactly do I create a group of values through simple syntax way (no arrays and no for loops), and then compare every
individual unit of the group to 5. (Without having to do every one of them individually as explained above)
Would greatly appreciate an example.
if( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true ) |
if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false ) |
if (1<5 && 2<5 && 3<5 && 4<5 && 5<5 && 6<5 && 7<5 && 8<5 && 9<5 && 10<5)
?
Is there a way to do something like all of those compared to 5 without the array and for loop approach?
I thought
if ( (1 && 2 && 3 && 4 && 5 && 6 && 7 && 8 && 9 && 10) < 5 )
would be having it recognize 5, 6, 7, 8, 9, and 10 aren't less than 5 and display FALSE. it doesn't since it just sais "1 is true and 2 is true and 3 is true and 4 is true and 5 is true and 6 is true and 7 is true and 8 is true and 9 is true and 10 is true" and since all of that is seen as true its all a huge "TRUE" inside the parenthesis, which is a 1 and would be all true (or so I think).
Any way to not have to individually compare everything to five to achieve the desired outcome of not having to use an array and a for loop in order to compare the group of values to 5?
Just wanting to escape the excess verbosity of individually comparing all to 5 without an array and a for loop
if (1<5 && 2<5 && 3<5 && 4<5 && 5<5 && 6<5 && 7<5 && 8<5 && 9<5 && 10<5)You keep using constants, so we have no idea what you really want to do. Obviously 10<5 is false and anything && false is false.
If you have ten conditions, you need to test all ten. Or, put them into an array, sort it, and test the largest one.
Both are TRUE which would mean they are both one.
Then why does
work while the other one , which also means 1, doesnt?
I take it that its because its 6 whatever is true and then 7 is greater than five is also true.
However, I want to compare both 6 to 5 and also 7 to 5 without needing to do
Is there a way to compare correctly for example
Without needing to compare every single one of them to the 5, so that its sometething like all of them together compared to five?
I thought that
So i don't have to individually compare them all to five; you understand?
Anything like that available in mql4? Not using arrays or stuff like that; what I need is a simple syntax solution for this nothing complicated. Trying out all that occurs to me, so as to not have to repeat the >5 every single time for say 100 different numbers
A little weird to explain "cause my view is off".
Its essentially ON THE FLY creating a group of values through simple syntax way (no arrays), and then compare every individual unit of the group to 5.
The way I know how to do this involves arrays and for loops. Isn't there a simpler way?
If you have ten conditions, you need to test all ten. Or, put them into an array, sort it, and test the largest one.
Looks like can't be done without an array
Arrays necessary is what this approach had led me to believe, but I was hoping there was a less verbose approach that I didn't know about.