mardi 4 février 2020

Replacing if blocks [closed]

I have looked through the internet but could not find an answer, I mean it's easy to read especially for junior developers, however, I have a feeling that the code snippet could be written in more modern approach ending up saving lines of code. Would be nice to hear some thoughts from experienced developers

 if (isWorkOrder(str)) {
        processWorkOrderAndInvestigatorID(b, str);
    }
    if (isTitleLine(str)) {
        processIsTitle(b, str);
    }
    if (isBox(str)) {
        processIsBox(b, str);
    }
    if (isCaptureLine(str)) {
        processCaptureLine(b,str);
    }

Aucun commentaire:

Enregistrer un commentaire