Execution Interpretation Statement

 

Hi !!

Sorry if the question is a little trivial.

Is there a difference in the way these statements are executed/interpreted in mql4 or are they the same thing?

if (shorttime==stable)
{
if (longtime==stable)
{
dosomething();
dosomethingelse();
}

}

or

if((shorttime==stable)&&(longtime==stable))
{
dosomething();
dosomethingelse();
}
 

In the first instance, if (shorttime==stable) has to be true in order to proceed to the next line.

In the second instance,  if((shorttime==stable)&&(longtime==stable)) both has to be true b4.

 
ubzen:

In the first instance, if (shorttime==stable) has to be true in order to proceed to the next line.

In the second instance, if((shorttime==stable)&&(longtime==stable)) both has to be true b4.

...In other words, yes, their effect is identical. (Lots of previous discussion on this forum about the fact that version 1 is very marginally faster than version 2 because MQ4 does not exit early from conditional tests. But the difference is going to be microseconds at most.)
 
jjc:
...In other words, yes, their effect is identical. (Lots of previous discussion on this forum about the fact that version 1 is very marginally faster than version 2 because MQ4 does not exit early from conditional tests. But the difference is going to be microseconds at most.)

That was quick. Thanks ubzen and jjc !!
Reason: