Greg's co-worker really wanted to make sure that a variable was correctly set to true or false. So they did this:

if (isValid == true)
{
	isValid = true;
}
else
{
	isValid = false;
}

If isValid is true, set it to true, otherwise set it to false. isValid is a boolean in C#, so the only options it could have are true and false.

The real WTF is that in languages with truthiness, this code may actually be useful- converting a falsey value to a literal false. But in C#, this is both useless and stupid.

[Advertisement] Otter – Provision your servers automatically without ever needing to log-in to a command prompt. Get started today!

Remy Porter

Source link

You May Also Like

Harry and Megs create royal rap song

Everything else failed: interviews, books, Netflix film, the Manhattan car chase. Still,…

EasyJet allowed a plane to take off with a backless seat, then asked OP to delete the tweet before word spread

Tags: wtf 19142 points, 772 comments. Source link

They were laughing and joking in the court. That's south africa for you

Tags: wtf, news, always 10758 points, 2177 comments. Source link

Its all lies!

Tags: Funny 3047 points, 124 comments. Source link