mardi 28 février 2017

Why does negation comparison in IF statement invokes a method

I have following code

if ( !handleOptions(args) ) {
        return false;
    }

    if ( !initConfig() ) {
        logger.error("Error initializing configuration. Terminating");
        return false;
    }

And the code itself is self explaining until I noticed that there are no else statements and yet, methods handleOptions and initConfig are called and executed. How does that work? From what I know, the parameters of if clause (in this case) are either determined true and then exception is thrown, or, they are false in which case I would expect else, yet I dont see one and code is still executed.

Aucun commentaire:

Enregistrer un commentaire