choose beetween "&&" or "||" via boolean input

To add comments, please log in or register
distress
8
distress  

Hi,

I'm not sure I'm able to explain:

I'm trying to do some tests and I need to choose beetween && and || operator fore some conditions.

For example: which do give best result beetwen:

- if ( (condition1)&&(condition2) ) {  ordersend...}

- if ( (condition 1) || (condition2) ) {  ordersend... }


Is there any way tu put the operator into a boolean input, so that the user can choose beetwen && or ||, and try an optimization?

Otherwise is it possibile ti "print" mql code ad in PHP, so that you could put the oeprator into a viaribale and print its value according to user input?


Hope have explained in my bad english...thanks!!!

Max

Alain Verleyen
36620
Alain Verleyen  
distress:

Hi,

I'm not sure I'm able to explain:

I'm trying to do some tests and I need to choose beetween && and || operator fore some conditions.

For example: which do give best result beetwen:

- if ( (condition1)&&(condition2) ) {  ordersend...}

- if ( (condition 1) || (condition2) ) {  ordersend... }


Is there any way tu put the operator into a boolean input, so that the user can choose beetwen && or ||, and try an optimization?

So what, just do it.

input bool  make_your_choice   = true;  // true => && , false => ||

if(make_your_choice){
  if ( (condition1)&&(condition2) ) {  ordersend...}
}
else {
  if ( (condition 1) || (condition2) ) {  ordersend... } 
}


Otherwise is it possibile ti "print" mql code ad in PHP, so that you could put the oeprator into a viaribale and print its value according to user input?

No.
whroeder1
17927
whroeder1  
enum Test { EitherCondition, BothConditions };
input Test test = EitherCondition;
:
if( test == BothConditions
    ? (condition1 && condition2)
    : (condition1 || condition2)
   ) {  ordersend... } 
To add comments, please log in or register