DEV Community

Discussion on: When is nesting good or neutral?

Collapse
 
lito profile image
Lito

And what about:

function conditionalsOrNo() throws AnException {
    if (!codeIsNotVolatile) {
        throws new YouShouldRefactorException();
    }

    if (!codeIsMaintainedByMe) {
        throws new WhyAreYouTryingToCauseYourselfPainException();
    }

    return writeConditionals();
}

Easy to read and no nested code.

Collapse
 
cishiv profile image
Shivan Moodley

That works too. The lack of braces is just my lazy inner java dev showing