6

The second you write `else { return false; }` you should lose the privilege of calling yourselves a dev, from then on. Period.

Example,
if(condition) {
// ...some code
return true;
} else {
return false;
}

Comments
  • 9
    you just wrote it... see rant

    now stop calling yourself a dev
  • 1
    Teeechnically I wrote it twice, and you know that two negatives make a positive.

    Haha, checkmate fam.
  • 5
    if(!condition) {

    return false;

    } else {

    // ...some code

    return true;

    }
  • 1
    @Grumm you're proud of yourselves aren't you
  • 6
    If the condition is a long expression, then this is better. But then it’s even better to store it in a variable with a meaningful name and then return it directly:

    let iAmBraindead = myIQ <= 0 || myName.startsWith("o") && myName.endsWith("m")
    return iAmBraindead
  • 1
    @Lensflare I see what you did there. Nicely done lol 😆😆
  • 0
    Stop using "else" statements.
    Problem fixed.
  • 0
    the moment you used an "if".
  • 3
    Who cares - the only thing I really care about is if our code is simple, explicit, and easy to understand for better team cohesion
  • 1
    @shovethisrant suck my cohesion
  • 4
    bool rantIsGhey(bool gatekeeping){

    bool ghey

    if(gatekeeping){

    ghey = true

    }else{

    ghey = false

    }

    return ghey

    }
  • 1
    Nope, not how it works
  • 0
    Replace that with just returning condition
  • 0
    i'm partial to returning an object or False if a failure occured. it's like returning null but it won't break shit if you try to do other things with it, so you can be a little late in error handling if required for whatever reason. This doesn't apply if you have a language that doesn't have auto-casting, however.
Add Comment