Morning all,
So a quick question about brackets, which is correct?
..or do you bracket the individual conditions within the function call, as follows:
or does it make no difference at all?
Many thanks and all the best to y'all!
The first is correct.
The second is also correct but there is no need for the additional brackets.
The compiler will normally warn you if there is a possible need for additional brackets.
-
Perhaps you should read the manual. Precedence Rules - Operations and Expressions - Language Basics - MQL4 Reference
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.You should know that Logical AND operation (&&) is lower precedence than less than (<). Thus, the parentheses are redundant.
-
When mixing ANDs (&&) and ORs (||) always use parentheses.
- TheHonestPrussian: So a quick question about brackets,
Be aware of the different uses of the words brackets/braces.
-
Be aware of the different uses of the words brackets/braces.
Ah, so my question should have been, " So a quick question about Parentheses".
Looking at the documentation for this, I think I'll stick with the US terms. Trust the British to make things complicated!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Morning all,
So a quick question about brackets, which is correct?
if(a < b && c < d){ ... }
..or do you bracket the individual conditions within the function call, as follows:
if((a < b) && (c < d)){ ...... }
or does it make no difference at all?
Many thanks and all the best to y'all!