0

$variable = (condition) ? 'static value' : 'static value';

Why do you need the conditional! 😵

Comments
  • 0
    Single equals. Is invalid anyway 😉
  • 1
    Is it supposed to illustrate two different static values or one and the same?
  • 0
    @fuckinghipsters honestly there was more deliberation on my part, on how to make that clear than necessary. But here's an example to fix that.

    $isOP = ($name == 'RStrydom') ? true : true;
  • 0
    @itsdaniel0 haha are you trolling or not used to seeing ternary conditionals?
  • 0
    @RStrydom I misread. Thought you were checking if condition equaled variable. Too early for devRant I think 😂
  • 0
    I guess it would make sense if someone who was very very afraid needed to make one miniscule change and then spent a good amount of time praying to the gods that he didn't break anything.

    I see a few of those kinds of lines produced by our juniors and interns.
  • 0
    @fuckinghipsters I know what you are saying, but with version control you should feel comfortable restructuring a piece of code rather than changing as little as possible in fear.
  • 1
    What? You mean you guys don't always assign your variables twice just to be sure?

    var foo = 3
    // i said 3 dammit
    foo = 3
  • 0
    @RStrydom correct, sadly alot of the freshies I get are even more afraid of git than runtime errors.

    It takes patience of steel, and the authority to do a 'git blame', identify the culprit and then tap their shoulder and kindly ask them to clean it up.
Add Comment