conditional operators buggy? (lips>teeth)&&(teeth>jaw) and the seocnd way (lips>teeth>jaw) gave me different results
if(lips>teeth>jaw)
I would never write code like this, I would do it as your other method.
I believe that the conditions are tested from left to right.
Firstly
if(lips>teeth)
is evaluated to true or false. If false it is enumerated as zero. If true, according to the docs it can be enumerated to any other number, but it seems to be always 1.
Then the 2nd part is evaluated, using the value from the first part.
So if the first part is true, the 2nd part will be
if(1>jaw)
iif the first part is false, the 2nd part will be
if(0>jaw)
I may be wrong
Binko_Binev: But when I use if(lips>teeth>jaw)
Exactly. true = 1 and false = 0 so you getif( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true ) | if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false ) |
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
Hallo, I am a newbie so it may be a very stupid question.
I have used the following script
So when I use this conditional operator I get as a result as of 24.01.2016 01:33 GMT GBPNOK,M1 21:13 22.01.2016 jaws:12,53444 teeth:12.53556, lips:12:53683 j=164
Which is correct also accorinf to the built-in alligator
But when I use if(lips>teeth>jaw)
I get as a result j=3904 (the large number made me suspicious), lips=29,23737 teeth=29,22346 and jaw=0.0.
In debugging it just evaluated the condition as false, although it was true, even with the zero value for jaw. then j was 5.
Now I saw that with this condition I also had zero values for lips with other symbols.
AS I said I am a newbie here, so have I done something wrong or this operator should not be used.
Thank you all for reading my long message