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
-
So that's utterly stupid code, but was it actually called from anywhere else, or had they just accidentally left it in place? I'm trying to reason what would possess someone to write that.
-
viking817408y@mclovinit oh no :) it's used several times for label messages ..
I can't edit the rant to add screenshots, but it's used like this;
SyncToggleLabel = IfThenElse(syncEnabled, "Sync Enabled", "Sync Disabled"); -
viking817408yIt's C#. And it was returning false, the test succeeded because it was wrong too :P
Nothing clever here at all, a simple ? would do the exact same thing -
stinky208yThis construct is about as useless as a third trit if you get the joke.
A base-three system is used in Islam to keep track of counting Tasbih to 99 or to 100 on a single hand for counting prayers (as alternative for the Misbaha).
Also used in transistor logic and fast addition, none of which seems applicable to this use case. But would need to know more about the code to decide what could be done to make it more supportable.
https://en.m.wikipedia.org/wiki/...
Related Rants
Going through code left by a senior developer who quit.. Dated 2015..
public static T IfThenElse<T>(bool isTrue, T ifYes, T ifNo)
{
if(isTrue) { return ifNo ; }
else if(!isTrue) { return ifNo ;}
Debugger.Break();
throw new Exception("") ;
}
.....
There was a unit test for it well
....
............. Wow, just wow
undefined
wrong on so many levels
no words
notkidding
omg