[Solved] Using single else statement for multiple if conditions [closed]


You can use a Boolean flag which is set in any of your ifs.

bool noPathTaken = true;
if ( condition1 ) {
    noPathTaken = false;
    // ...
}
if ( condition2 ) {
    noPathTaken = false;
    // ...
}
// ...
if ( noPathTaken ) { // this would be your "else"
    // ...
}

0

solved Using single else statement for multiple if conditions [closed]