lundi 25 décembre 2017

Return multiple values from array when if condition satisfies multiple times

I want to return multiple values from for loop and if my condition satisfies more than one time

for(var i=0;i<graphVariableCount;i++)
  {
     if(commandResponse.GenericName == graphVariables[i].variable.index)
     {
        return graphVariables[i].variable.index;
     }
  }  

In above code i am able to return only one value. If GenericName of graphVariable[i].variable.index is same for 4-5 variables. Then how am i able to return that values.

Aucun commentaire:

Enregistrer un commentaire