Yes or No "switch"?

 
Whats the simplest way of using an extern string "Yes" or "No" to activate or deactivate a void function?
 
DomGilberto:
Whats the simplest way of using an extern string "Yes" or "No" to activate or deactivate a void function?

Something like this . . . off the top of my head, not tested . . .

extern string YesOrNo = "";


bool Yes = FALSE;


if(YesOrNo == "YES" || YesOrNo == "Yes" || YesOrNo == "yes") Yes = TRUE;


//call the function
A_Function(Yes)


// declare the function
void A_Function(bool lYes)
   {
   if(!lYes) return;
   
   //   rest of function . . .

   }
 
Yea nice one thanks (all but moving the 1 at the end of "1Yes" like so "Yes1"). How could I go about having a drop down as an extern Yes or No? As opposed to writing it in the box within the parameters? (i.e. not a string but drop-down)
 
DomGilberto:
Whats the simplest way of using an extern string "Yes" or "No" to activate or deactivate a void function?

I would suggest an enum (to tested!):

enum isBool {
        fs, // no, false
        tr  // yes, true
};
extern isBool   UseFuncA = fs;
extern isBool   UseFuncB = tr;
..
if ( UseFuncA == 1 ) x = funcA(..);
 
DomGilberto:
Yea nice one thanks (all but moving the 1 at the end of "1Yes" like so "Yes1"). How could I go about having a drop down as an extern Yes or No? As opposed to writing it in the box within the parameters? (i.e. not a string but drop-down)
enum YesOrNo {No=0,Yes=1};
extern YesOrNo ActivateFunction=Yes;

Edit: sorry gooly, must have posted at the same time.

 
bool Yes = FALSE;

if(YesOrNo == "YES" || YesOrNo == "Yes" || YesOrNo == "yes") Yes = TRUE;
If must be in init.
bool Yes = FALSE;
OnInit(){
 Yes = YesOrNo == "YES" || YesOrNo == "Yes" || YesOrNo == "yes";
 
DomGilberto:
Yea nice one thanks (all but moving the 1 at the end of "1Yes" like so "Yes1"). How could I go about having a drop down as an extern Yes or No? As opposed to writing it in the box within the parameters? (i.e. not a string but drop-down)
It's an l as in Local   as has been said,  use an enum . . .  I've not used them in mql4 . . .  I have in LabVIEW though 
Reason: