Agent86:
Curious if these the same ?
I assume the compound operators need to be in brackets, but I've seen code written this way and wondered why ?
Please confirm thanks
Curious if these the same ?
I assume the compound operators need to be in brackets, but I've seen code written this way and wondered why ?
Please confirm thanks
Is the same as:
if(A_high())
{ ObjectSet("B6",OBJPROP_BGCOLOR,clrRed); } else
{ ObjectSet("B6",OBJPROP_BGCOLOR,clrBlack); ObjectDelete("Ahigh"); } if(A_high())
{ ObjectSet("B6",OBJPROP_BGCOLOR,clrRed); } else
{ ObjectSet("B6",OBJPROP_BGCOLOR,clrBlack); }
ObjectDelete("Ahigh");
You don't need brackets for a single operation, but for compound operations, yes.
So Example1 is equivalent to Example2 below.
I suppose its good practice to bracket all, but I do anything to avoid too many brackets!
// Example 1 if(A_high()) { ObjectSet("B6",OBJPROP_BGCOLOR,clrRed); } else { ObjectSet("B6",OBJPROP_BGCOLOR,clrBlack); ObjectDelete("Ahigh"); } // Example 2 if(A_high()) ObjectSet("B6",OBJPROP_BGCOLOR,clrRed); else { ObjectSet("B6",OBJPROP_BGCOLOR,clrBlack); ObjectDelete("Ahigh"); }
Agent86:
Curious if these the same ?
I assume the compound operators need to be in brackets, but I've seen code written this way and wondered why ?
Please confirm thanks
I am suggesting you to always use brackets. One day or an other it will save you a lot of time.
Curious if these the same ?
I assume the compound operators need to be in brackets, but I've seen code written this way and wondered why ?
Please confirm thanks
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
I assume the compound operators need to be in brackets, but I've seen code written this way and wondered why ?
Please confirm thanks