Totally Valid
by in CodeSOD on 2024-05-02Greg'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;
}
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;
}
Meta-programming- programs which generate programs- is a delightful hobby, but usually shouldn't be used in production code. Usually. I mean, if you're working in LISP, 90% of your program is going to be macros.
But if you're using PHP and JavaScript, there's good odds that someone you work with has decided to combine these two tastes together to create something nobody wants to taste.