• [^] # Re: Goto tabou

    Posté par . En réponse au journal <3 goto. Évalué à 1.

    D’ailleurs, est ce que

    bool exit = false;
    while (!exit) {
     doSomething();
     if ( truc ) {
     exit = true;
     } else {
     doSomethingElse();
     }
    }

    est mieux que (en conservant les commentaires) :

    while (1) { // exit on break
     doSomething();
     if ( truc ) { // only way to exit of the function
     break;
     }
     doSomethingElse();
    }

    ?

    bépo powered