12

Came across a method in the code base that returns a boolean.

It uses a ternary operator which returns true if the result is true and false.. you guessed it... if the result is false.

WHY NOT JUST RETURN THE FUCKING RESULT!!!

What. The. F#%#....

Comments
  • 1
    @cako91 I guess this makes sense just incase what's passed is somehow not a bool, or is null and you want to assume false if it fails
  • 0
    @cako91 quite possibly, however as far as weird code goes this could make some sense, it's worse when people take numbers and force them to strings, or even worse take a Boole and make it a string like:

    if $var.tostring() == "true"
Add Comment