Download MetaTrader 5
To add comments, please log in or register
The entire MQL5.community history on a single page!
mostafalotfi
185
mostafalotfi 2014.07.28 19:53 

Dear friends ,

 

i have a question for "if" and it would be great if you help me

 

is it correct to write something like this?

 

if((A1>100 && A2<100) || (B1>100 && B2<100));
Keith Watford
Moderator
7886
Keith Watford 2014.07.28 20:11  
Yes
mostafalotfi
185
mostafalotfi 2014.07.28 20:39  
GumRai:
Yes


Thank you, 

 

what about this one? should be ok , right?

if((A1>100 || A2<100) && (B1>100 || B2<100));
Keith Watford
Moderator
7886
Keith Watford 2014.07.28 21:02  
yes
honest_knave
951
honest_knave 2014.07.29 06:07  
Regarding the brackets, it might also be worth having a quick read through the precedence rules
Michele Lazzarini
470
Michele Lazzarini 2014.07.30 20:56  

Use of () is recommended.

You can also write this way to make your code clearer:

if(   ( A1>100 || A2<100 )
   && ( B1>100 || B2<100 ) 
  ) ...
/
To add comments, please log in or register