Help me code mql4

To add comments, please log in or register
Nguyen Dang Giang
12497
Nguyen Dang Giang  

I want to create a function similar to:

void  Print(
   argument,     // first value
   ...           // next values
   );


or

uint  FileWrite(
   int  file_handle,   // File handle
   ...                 // List of recorded parameters
   );


Example function:

bool checkCharacters(argument)
{

if(argument=="a") return(true);
if(argument=="a" && argument=="b") return(true);
if(argument=="a" && argument=="b" && argument=="c") return(true);
if(argument=="a" && argument=="b" && argument=="c" && argument=="d")r eturn(true);
if(argument=="a" && argument=="d") return(true);

return(false);}

}

Call function:

checkCharacters("a","d"); // result true

checkCharacters("a","a"); // result true

checkCharacters("a","b","z"); // result false


Thanks everyone!


William Roeder
20207
William Roeder  
Nguyen Dang Giang: I want to create a function similar to:
  1. Variable arguments can't be done. Variable types can't be done.
  2. Try default arguments
    bool checkCharacters(string a, string b="", string c="", string d="")

  3. Or put the arguments in an array and pass that.
Nguyen Dang Giang
12497
Nguyen Dang Giang  
whroeder1:
  1. Variable arguments can't be done. Variable types can't be done.
  2. Try default arguments

  3. Or put the arguments in an array and pass that.
I want a dynamic parameter like the function Print().

Thanks whroeder1.
To add comments, please log in or register