Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Looks like someone did in on purpose to try the true branch, but forgot to replace it afterwards. Some of my coworkers do it all over the place.
-
arnyek5578y@JacksOnF1re I guess you're right, but it can be solved with if(true) - it's just funny to see it this way.
And it's more funnier with the fact that the project is in production since a while and we just received it for maintenance. -
@SubbySnake that's true :) but I guess 1==1 does not produce a warning, while if(true) maybe does.
-
Eariel19068y@SubbySnake, I'd rather comment the if statement and else branch. It's easier to spot when you are checking your changes before commit.
-
arnyek5578y@Eariel yup, I always put comments to the questionable parts of my codes (and use speaking variable and function names, so I have to comment less).
The problem above is that we received the source code from our client and it's made by other devs who we don't know, nor their intentions with their code - and still, it isn't commented at all and uses not-too-speaking names - but that if statement made my day :D -
if ( 1 != -1 ) {
//why is there even a conditional
} else {
//Chance of running: 0%
}
Let's think of more ridiculous ways to say if (true)
Related Rants
My team mate has just found the best conditional statement I've ever seen, in a source code he received from the client.
if (1 == 1)... and it has an else branch :D
undefined
if else
ffs
source code
funny