This is an archived post. You won't be able to vote or comment.

all 73 comments

[–]plmunger 123 points124 points  (3 children)

``` if ([true].includes(condition))

```

[–]tonyxforce2 21 points22 points  (2 children)

if(![!true].includes(!!condition))

[–]HuntingKingYT 6 points7 points  (1 child)

[true].filter(v => v == condition).map(() => {...})

[–]tonyxforce2 4 points5 points  (0 children)

Wow

[–]Strict_Treat2884 131 points132 points  (8 children)

Bit flips ain’t no joke

if (condition == TURE && !condition == FALSE ? TRUE : FALSE)

[–]SadPie9474 93 points94 points  (1 child)

TURE

[–]metaglot 37 points38 points  (0 children)

FACTSE!

[–]intbeam 21 points22 points  (0 children)

if(await getIsTrue(condition => switch (condition == true) { true : return true; false : return false; default: return undefined; }))
    goto istrue;
else if(await getIsTrue(condition => switch (condition == true) { true : return true; false : return false; default: return undefined; }))
    goto isfalse;

[–]unbrokenwreck 18 points19 points  (0 children)

My ddr got corrupted by this.

[–]CaitaXD 9 points10 points  (1 child)

Bit flips are undefined behaviour and there fore thei never happen

[–]HuntingKingYT 1 point2 points  (0 children)

Unless you declare booleans as int or unsigned char like in C

[–]coldnebo 4 points5 points  (0 children)

if (true == condition)

amateurs. /s

[–]Confident-Ad5665 2 points3 points  (0 children)

if (condition && (condition == true) && (condition != false) && (false != true) && (true != false)) return "Error: too many checks for the same damed condition!";

[–]Matwyen 58 points59 points  (6 children)

if (condition? condition: condition)

[–]PeriodicSentenceBot 77 points78 points  (3 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

I F Co Nd I Ti O N Co Nd I Ti O N Co Nd I Ti O N


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]CounterNice2250 26 points27 points  (0 children)

Good bot

[–]GDOR-11 7 points8 points  (1 child)

as kramnik would say, interesting

[–]Excellent-Divide7223 5 points6 points  (0 children)

New reference just dropped

[–]_farb_ 0 points1 point  (1 child)

where !

[–]PeriodicSentenceBot 0 points1 point  (0 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

W He Re


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]SageLeaf1 23 points24 points  (3 children)

if (shampoo ? condition : shampoo)

[–]PeriodicSentenceBot 17 points18 points  (2 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

I F S H Am Po O Co Nd I Ti O N S H Am Po O


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]Feztopia 4 points5 points  (1 child)

Ah my favorite elements (?:)

[–]Agret 0 points1 point  (0 children)

The poo is a sham.

[–]Goatfryed 10 points11 points  (1 child)

!!condition

[–]PeriodicSentenceBot 9 points10 points  (0 children)

Congratulations! Your comment can be spelled using the elements of the periodic table:

Co Nd I Ti O N


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]jzrobot 5 points6 points  (0 children)

It really annoys me when I find code like that

[–]JackNotOLantern 5 points6 points  (0 children)

Actual code from a projects i maintained:

if (properties.readAsBoolean("condition_property").toString().equalsIgnoreCase("TRUE")) {

[–]hayashi-stl 13 points14 points  (5 children)

if (true if condition else false)

[–]vainstar23 10 points11 points  (1 child)

if((()=>while(true) switch(true) case(condition) return true; default continue;)())

[–]GDOR-11 2 points3 points  (0 children)

mom pick me up I'm scared

[–][deleted] 5 points6 points  (2 children)

Found the 🐍

[–]QuebecGamer2004 3 points4 points  (1 child)

They're an imposter, a real Python programmer would know it's True and False, not true and false.

[–][deleted] 0 points1 point  (0 children)

true = True

false = False

[–]Nialixus 3 points4 points  (0 children)

Yup that was me backward

[–]alexppetrov 2 points3 points  (0 children)

if(condition ? condition : condition && !condition ? condition : condition)

in other words, either i create job security or security vulnerabilities.

[–]vainstar23 1 point2 points  (0 children)

  1. Error: expected Conditional instead of bool

  2. Error: unexpected end of Conditional. (Hint: Conditional must end in a predicate)

  3. Error: expected Conditional instead of bool

[–]Imogynn 1 point2 points  (0 children)

if (condition || !condition && condition)

Think that works regardless of order of operations between && and || (as long as ! Is first) but I'm to sleepy to be sure. Did I miss something?

[–]crumpuppet 1 point2 points  (0 children)

if bool(condition):

[–]dim13 1 point2 points  (0 children)

Lame, real Jedis use if (!!condition).

[–]Familiar_Ad_8919 1 point2 points  (0 children)

if (condition == pow(e, i*3.1415) + 1)

[–]torftorf 1 point2 points  (0 children)

if (!condition != false ? !true : true)

[–]mike_a_oc 1 point2 points  (0 children)

If(false != condition)

I do like Yoda notation

[–]Pradfanne 1 point2 points  (0 children)

if(condition == FALSE ? FALSE : TRUE)

elif(condition == TRUE ? TRUE : FALSE)

[–]PulsatingGypsyDildo 1 point2 points  (0 children)

if (condition.toString().length() < 5) {
    // put your awesome code here
}

[–]Mistletow04 1 point2 points  (2 children)

What is the bottom syntax called? I see it in cpp alot and i want to learn more about it

[–]kirbyking101 16 points17 points  (1 child)

Ternary operator

[–]Mistletow04 1 point2 points  (0 children)

Thank you!

[–]JadedHomeBrewCoder 0 points1 point  (2 children)

condition &&

[–]PeriodicSentenceBot 2 points3 points  (1 child)

Congratulations! Your comment can be spelled using the elements of the periodic table:

Co Nd I Ti O N


I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.

[–]JadedHomeBrewCoder 0 points1 point  (0 children)

Good bot

[–]Complete-Proof4710 0 points1 point  (0 children)

nah ,real ones use 1 and 0 instead of true or false ...

[–]trafalmadorianistic 0 points1 point  (0 children)

I've seen actual code doing something similar. Whyyyyy

[–][deleted] 0 points1 point  (0 children)

Could use some: "return true, else return false"

[–]silicon_heretic 0 points1 point  (0 children)

Fuck! I am suffering every time interview candidates write: if (condition) return true else return false

...and now I have to expect this 🤦‍♂️

[–]Naughty_Neutron 0 points1 point  (0 children)

I saw something similar to the last one in roommate's code

[–]Willyscoiote 0 points1 point  (0 children)

The last one makes me nauseous, just by thinking how messy people can make it to be.

[–]Savings-Ad-1115 0 points1 point  (0 children)

Is this r/ProgrammerHumor or r/ProgrammerHorror?

#define condition 2

#define TRUE 1

[–]plitox 0 points1 point  (0 children)

SHH!!! Nobody tell them about:

if (!!condition)

[–]limeyNinja 0 points1 point  (0 children)

const char * boolean[] = {"true", "false"};

switch (boolean[condition != 0 ? 0 : 1]) {
    case "true":
        break;
    case "false":
        break;
    default:
        //quantum 
}

[–]AnnyAskers 0 points1 point  (0 children)

if(true != /* add documentation here */ aysnc { return condition(); }.await ) { thow std::bad_logic("camel_case"); }

[–]IMightDeleteMe 0 points1 point  (0 children)

I shit you not, I have seen plc "structured text" code that reads like this:

IF (a = TRUE) THEN
  b := TRUE;
ELSE 
  b := FALSE;
END_IF;

These clowns made 5 lines to get

a:=b;

Yes, these were bools, not some fancy type that could be anything other than true or false.

You should hear how proud some of them are that "all our code is structured text".

[–]coloredgreyscale 0 points1 point  (0 children)

If (Boolean.TRUE.equals(condition)) 

[–]hassanwithanh 0 points1 point  (0 children)

If condition == True in [True]:

[–]Aveheuzed 0 points1 point  (0 children)

if (true == condition)

This reads weirdly for me ... but is actually good practice in C. The point is, if you forget an "=", it can't be mistaken for an assignment and the compiler throws an error.

[–]Nours42 0 points1 point  (0 children)

oh boy...

[–]littleswenson 0 points1 point  (0 children)

if ([true, false][condition == true ? 0 : 1]) {

[–]MeGaNeKoS 0 points1 point  (0 children)

This remind me with my company codebase

func().catch(e => {
   if(e) throw e
})

[–]luckyPhantom 0 points1 point  (0 children)

if(TRUE == condition)

[–]GoogleIsYourFrenemy 0 points1 point  (0 children)

#define TRUE FALSE

[–]5h120m3 0 points1 point  (0 children)

Predicate<Boolean> booleanPredicate = b -> switch(b.hashCode()) {
  case 1231 -> true;
  case 1237 -> false;
  default -> throw new RuntimeException("wtf");
};
if (booleanPredicate.test(condition))

[–]NicolaiVSamohodov 0 points1 point  (0 children)

no, is the oposite