Using brackets helps determine which group it goes. Something like ..
// - without brackets if(2+1>2)Print("1");Print("2"); // - with brackets if(2+1>2){ Print("3");Print("4"); }
Using brackets helps determine which group it goes. Something like ..
Hi thanks for the fast reply!
Im not that good in cooding. But do you mean that the result in your example would print out only "1" without brackets and "3" and "4" with brackets?
Try to play around so that you know what would happens.
=) thanks! Tested just now, and my conclution, - the results is the same and the extra brackets are for the coder to see witch group it belongs to. Or am i wrong??
For the coder and machine. Wrong brackets usage will result in wrong executions.
Ok but in this example, the outcome/result is the same? In witch case do you mean that the machine will do something different with these two examples?
// - without brackets if(2+1>2)Print("1");Print("2"); // - with brackets if(2+1>2){ Print("3");Print("4"); }
Not much differences since this is simple logic. When it is involved with complex logic, you will see how the brackets works the magic.
Try doing some complex logic and you will see.
Nice =) Do you know where i can find examples?
// - with brackets if(2+1>4){ Print("3"); } Print("4"); // - with brackets if(2+1>4){ Print("3"); Print("4"); }There you have it. Not complex but good enough.
So first example returns 4 and second returns 3 & 4
if(2+1>4){ Print("3"); } Print("4"); //returns 4 if(2+1<4){ Print("3"); } Print("4"); //returns 3 and 4
And when i play around accordingly to the original question, i get the same results.
{if(2+1>4){ Print("3"); } Print("4");} //returns 4 {if(2+1<4){ Print("3"); } Print("4");} //returns 3 and 4
Correct me if im wrong. If wrapping in the whole icustom function with brackets, wont do any diffrence, unless its not a part of a complex logic.?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi have an EA question, what is the correct way of using icustom. Why i am asking is becuase both ways are working for me with no issues.? :S
Like this?
Or like this with brackets wrapping the custom indicator.