mardi 25 juin 2019

Alternative for huge if else statement

I have a huge data, and i need to filter them to get certain value according to Choices, i tried to use if else but it was so hard because it is really huge and nested.

    if(Type == "H" && Tech =="2A")
    {
       if(Level == "ground")
       {
        return "2AA";
       }
       else if (Level == "UP"){
        return "2AB";
    }

}
else if(Type == "H" && Tech =="3A"){
 if(Level == "ground"){
    return "3AA";
    }
    else if (Level == "UP"){
    return "3AB";

}

 else if(Type == "E" && Tech =="2B"){
 if(Level == "ground"){
    return "3BB";
    }
    else if (Level == "UP"){
    return "3BC";

}

Aucun commentaire:

Enregistrer un commentaire