Need help to change function into bool that can be called many times with ability to change parameter

 

How can I turn this function into bool? it only has 1 error which is the default value for the array. How can I correct it?

Thank you in advance for assistance.


bool ExtractInputNumber(string input_number="1;2;3;4",

                                      double &inputarray[])   <----- 'inputarray' - missing default value for parameter

{

//Extract input and remove ";"
    input_number = StringTrimLeft(StringTrimRight( input_number ));
   if (StringSubstr( input_number ,StringLen( input_number )-1,1) != ";")
                    input_number = StringConcatenate( input_number ,";");
//Convert input into output array 
   int n=0,i=StringFind( input_number ,";",n);
   string current;
   while (i > 0)
     {
       current = StringSubstr( input_number ,n,i-n);
       ArrayResize( inputarray ,ArraySize( inputarray )+1);
                    inputarray [ArraySize( inputarray )-1] = current;
                        n = i + 1;
                   i = StringFind( input_number ,";",n);
     }
}

 
Seng Mmar: How can I turn this function into bool?
  1. It already is; you just have to return a bool value before ending.

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  3. You can simplify by using StringSplit instead of subscr.