The operator "or"

Back to topics list To post a new topic, please log in or register
avatar
19
Eric1704 2015.06.12 03:42
 

While using "or" for say 5 statements, if the first or second return true will MQL4 still check all 5?

Thank you. 

avatar
736
honest_knave 2015.06.12 07:27 #
 

No.

From MetaTrader 4 Trading Terminal build 600 with Updated MQL4 Language and Market of Applications Released:

  • Shortened conditions check is now used in logical operations, unlike the old MQL4 version where all expressions have been calculated and the check has been performed afterwards. Suppose there is a check of two conditions with the use of logical AND
      if(condition1 && condition2)
        {
         // some block of operations
        }
    If condition1 expression is false, calculation of condition2 expression is not performed, as false && true result is still equal to false.

 

Back to topics list  

To add comments, please log in or register