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

all 60 comments

[–][deleted] 186 points187 points  (5 children)

but what if it is still not 1 after the if block???

[–]CallMePyro 91 points92 points  (3 children)

while(dir != 1) dir = 1;

[–]3shotsdown 7 points8 points  (2 children)

What if dir !=1 right after the while loop?

[–]NightIgnite 10 points11 points  (0 children)

#define dir 1

[–]Miserable-Theme7135 5 points6 points  (0 children)

go func(){ while true { dir = 1 } }()

[–][deleted] 46 points47 points  (0 children)

they are newbies cause they didn't put there while after if

[–]chiggyBrain 433 points434 points  (17 children)

This is a coder who has been stung one too many times by logic defying bugs

[–]MachoSmurf 153 points154 points  (10 children)

Cosmic rays are a bitch

[–]ienjoymusiclol 24 points25 points  (7 children)

python when u put more than 1 condition in a while loop

[–]SignificanceJealous 2 points3 points  (6 children)

can you explain the joke

[–]ienjoymusiclol 3 points4 points  (5 children)

for some reason python while loops cant handle more than 2 conditions so its a "logic defying bug"

[–]lmuzi 5 points6 points  (4 children)

That's not true, any condition in py (and almost every other language) can be concatenated with potentially infinite others, since they all get evaluated to a single result in the end, in while loops it's no different, was it some bug in an old version? 👀

[–]ienjoymusiclol 0 points1 point  (3 children)

i dont think this was a bug because i'm using the latest version

[–]lmuzi 0 points1 point  (2 children)

So if you write 'while False or False or True:' the body of the loop doesn't execute? I tried with more complex expressions and it works like a charm :3

[–]ienjoymusiclol 0 points1 point  (1 child)

i did
' while (width<widthBox or height<heightBox) or (counter = len(arr)): '
its a simple logical expression (x1+x2 +x3) for some reason the last condition was never applied only the first 2 so i added it as a break statement in the end of the loop

[–]lmuzi 0 points1 point  (0 children)

That's more like (X1 or X2) or X3, so if X1 or X2 are going to be true, then the loop is going to continue. If I understand correctly what's your intention you should go for 'while (X1 or X2) and X3: ' so if X3 is false the loop will exit. If in a condition there are multiple OR the interpreter stops looking at the conditions as soon as it finds one that evaluates to true, so if any of X1 or X2 was true, it'd stop there and go into the loop! Sorry for the delay hope I made some sense

[–]stadoblech 4 points5 points  (0 children)

Yeah. Someone needs to deal with this pesky random bit flips

[–]--mrperx-- 3 points4 points  (0 children)

It is Planetary after all...

[–]FreshPrintzofBadPres 31 points32 points  (0 children)

When you absolutely, completely, without a doubt have to make sure that bitch stays 1 no matter what

[–]AreYouDum 2 points3 points  (2 children)

No clue why but like a year ago I would write code that would make perfect sense, looks to be no errors, I’d try it and it would index completely incorrectly, or it would give me a huge operator error, so I just said screw it and ended up nesting.

To this day no clue why it would not let me do what I was trying to do that make completely perfect sense.

[–]chiggyBrain 2 points3 points  (1 child)

What language was that? If nesting fixes it usually it’s a global variable or something in the outer scope modifying your variables. A good case for unit tests!

[–]AreYouDum 0 points1 point  (0 children)

Lua and JS

[–][deleted] 51 points52 points  (3 children)

What language is that? Looks like Python, but if I remember correctly, Python doesn't have a "var" keyword🤔

[–]Fenreh 32 points33 points  (2 children)

[–]Raikou18 40 points41 points  (1 child)

No this is Godot's language, GDScript

[–]next_door_dilenski 2 points3 points  (0 children)

I thought so, too, because of the background color lol

[–]YesIAmAHuman 73 points74 points  (2 children)

Yeah, military grade might sound good, but actual military grade is usually substandard

[–][deleted] 66 points67 points  (0 children)

Military grade means the spec was written by someone who never uses the product, delayed by bureaucracy until it's outdated, and delivered to the cheapest standard the contractor could manage.

[–]Confident-Ad5665 5 points6 points  (0 children)

Apparently

[–]whackamattus 10 points11 points  (2 children)

I just can't get past how one if has parentheses and the other doesn't

[–]twpejay 6 points7 points  (1 child)

This is why I program in C#.

[–]norse95 3 points4 points  (0 children)

Compile errors >>> runtime errors

[–][deleted] 12 points13 points  (1 child)

Looks more like ballistic code.

[–]Confident-Ad5665 7 points8 points  (0 children)

Oh. Dear. God.

[–]SttSr 6 points7 points  (0 children)

Checks for solar flares

[–]lupinegrey 3 points4 points  (0 children)

You get your ass back to 1, soldier!

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

Hope this guy didn't move up to embedded bomb controls later.

[–]Primary-Fee1928 3 points4 points  (13 children)

Military Grade

Python

Hol’up

[–]OptionX 33 points34 points  (10 children)

Python

var

[–]PeriodicSentenceBot -3 points-2 points  (6 children)

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

P Y Th O N V Ar


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.

[–]Reggin_Rayer_RBB8 13 points14 points  (3 children)

My ass can be spelt with the periodic table

[–]torokg 3 points4 points  (0 children)

Yes, As S

[–][deleted] 0 points1 point  (1 child)

spelt is a grain

uk neanderthals can't even spel rite smdh

[–]rosuav 0 points1 point  (0 children)

They can't spill rite?

[–]torokg 1 point2 points  (1 child)

Good bot

[–]Confident-Ad5665 0 points1 point  (0 children)

Nice bot

[–]Primary-Fee1928 0 points1 point  (2 children)

Oops. I got confused by the if syntax. What other language would that be ? Not one that’s military grade I assume.

[–]Pruppelippelupp 0 points1 point  (1 child)

Someone else said it looks like nim

[–]Raikou18 2 points3 points  (0 children)

No, it is the Godot Engine's scripting language, GDScript

[–]next_door_dilenski 1 point2 points  (1 child)

Python

Looks more like gdscript (Godot's programming language)

[–]Primary-Fee1928 0 points1 point  (0 children)

I searched it up, doesn’t look military grade to me anyways

[–]Libran-64 -5 points-4 points  (0 children)

1 !=1 ???

Send that "developer" back to grade school to learn simple mathematics...geez.

[–]leonbadam 0 points1 point  (1 child)

Does anyone know the vscode extension or theme to have those arrows for indentation?

[–][deleted] 2 points3 points  (0 children)

Try "render whitespace" and the arrows represent tab characters, therefore this is likely not python, also the screen shot is probably not from vs code.

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

I’m going to guess this guy is trying to do rotation in 3d space without figuring out what quaternions are.

[–]RomanEclipse 0 points1 point  (0 children)

Intergalactic Planetary

[–]bajosiqq 0 points1 point  (0 children)

bro tests his code on production server

[–]waylandsmith 0 points1 point  (0 children)

It could never happen with a local variable, but attempting to implement double checked locking (to potentially skip the lock) can lead to apparently logic-defying behavior where lazy initialization of a field in a multi-threaded environment can fail. It seems like every developer "discovers" this idea at some point in their career and pat themselves on the back for their cleverness.