Computer
CodeSOD: Totally Valid
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!AM Radio Law Opposed By Tech and Auto Industries Is Close To Passing
Read more of this story at Slashdot.
PFAS Increase Likelihood of Death By Cardiovascular Disease, Study Shows
Read more of this story at Slashdot.
Google Lays Off Hundreds of 'Core' Employees, Moves Some Positions To India and Mexico
Read more of this story at Slashdot.
Unity Appoints Ex-Zynga Exec Matthew Bromberg As CEO
Read more of this story at Slashdot.
Congress Lets Broadband Funding Run Out, Ending $30 Low-Income Discounts
Read more of this story at Slashdot.
Anthropic Brings Claude AI To the iPhone and iPad
Read more of this story at Slashdot.
Roblox Players To Start Seeing Video Ads In Its Virtual Realms
Read more of this story at Slashdot.
Dropbox Says Hackers Breached Digital-Signature Product
Read more of this story at Slashdot.
National Archives Bans Employee Use of ChatGPT
Read more of this story at Slashdot.
Microsoft Says April Windows Updates Break VPN Connections
Read more of this story at Slashdot.
UnitedHealthCare CEO Says 'Maybe a Third' of US Citizens Were Affected By Recent Hack
Read more of this story at Slashdot.
Tens of Millions Secretly Use WhatsApp Despite Bans, Company Says
Read more of this story at Slashdot.
The BASIC Programming Language Turns 60
Read more of this story at Slashdot.
Google Urges US To Update Immigration Rules To Attract More AI Talent
Read more of this story at Slashdot.
Windows 10 Reaches 70% Market Share as Windows 11 Keeps Declining
Read more of this story at Slashdot.
LastPass Separates From GoTo
Read more of this story at Slashdot.
Microsoft Concern Over Google's Lead Drove OpenAI Investment
Read more of this story at Slashdot.
Global Debt Hasn't Been This Bad Since the Napoleonic Wars, Says WEF President
Read more of this story at Slashdot.
LinkedIn Now Has Wordle-style Games You Can Play Every Day
Read more of this story at Slashdot.