if(2+1>4)//3 is not bigger then 4
{ Print("3"); Print("4"); } //No print will be done
if(2+1<4)//3 is less then 4
{ Print("3"); Print("4"); } //Print will be done
I understand this but what i mean is this, witch is not equal to your first example in your src box.
if(2+1>4)//3 is not bigger then 4
{ Print("3"); } Print("4"); //returns 4if(2+1<4)//3 is less then 4
{ Print("3"); } Print("4"); //returns 3 and 4
And wrapping these, there is no difference is in result!
{if(2+1>4)//3 is not bigger then 4
{ Print("3"); } Print("4");} //returns 4
{if(2+1<4)//3 is less then 4
{ Print("3"); } Print("4");} //returns 3 and 4
So wrapping in the whole icustom function with brackets, wont do any diffrence, unless its not a part of a complex logic.?
When you use any of the operators. if, while, for etc. The braces define the scope of the operator.
example
if( var1 == var2 )
a=10;
b=20;
c=30;
// no braces is the same as braces around only the first operation so only a=10; is dependent on the if condition.
if( var1 == var2 )
{
a=10;
}
b=20;
c=30;
// b=20; c=30; are not included in the if operations and will be executed regardless in both cases.
if(var1 == var2)
{
a=10;b=20;
}
c=30;
//this time the braces mean both a=10; and b=20; will be executed when the if condition is true.//c=30 is still outside the scope of the if operator and will be executed regardless
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Try again ..
Make sure don't change anything in the code.
Try again ..
Make sure don't change anything in the code.
I understand this but what i mean is this, witch is not equal to your first example in your src box.
And wrapping these, there is no difference is in result!
{if(2+1>4)//3 is not bigger then 4 { Print("3"); } Print("4");} //returns 4 {if(2+1<4)//3 is less then 4 { Print("3"); } Print("4");} //returns 3 and 4So wrapping in the whole icustom function with brackets, wont do any diffrence, unless its not a part of a complex logic.?
So wrapping in the whole icustom function with brackets, wont do any diffrence, unless its not a part of a complex logic.
Correct brackets/bracers {}
i=0;
while(n<5)
{
if(p0>0) {p5=p4; p4=p3; p3=p2; p2=p1; p1=p0; }
p0=iCustom(Symbol(), 0, "mycustomindicator", 0, 0, 3, 0, i);
if(p0>0) {n+=1; }
i++;
}
int n=0;
for(int i=0; i < Bars && n < 5; ++i){
p[n] = iCustom(Symbol(), 0, "mycustomindicator", 0, 0, 3, 0, i);
if(p[n]>0) ++n;
}
lacement of braces is uber important.
When you use any of the operators. if, while, for etc. The braces define the scope of the operator.
example
lacement of braces is uber important.
When you use any of the operators. if, while, for etc. The braces define the scope of the operator.
function(){ code code { // Useless brackets code code } // Useless brackets code }lacement of braces is uber important.
When you use any of the operators. if, while, for etc. The braces define the scope of the operator.
Well yeah, but still, if he knows what they are supposed to be for he might better understand when they are not required.