r/badcode • • Jul 17 '20

js Found this "answer" on Stackoverflow. Pretty sure it's not working.

Post image
978 Upvotes

90 comments sorted by

View all comments

106

u/[deleted] Jul 17 '20 edited Jul 17 '20

[removed] — view removed comment

116

u/Gooftwit Jul 17 '20

And the min = min is also bot necessary

110

u/frankferri Jul 17 '20

I really enjoyed that part actually, I kind of wonder what was going through their head at that point

44

u/vigbiorn Jul 17 '20

OCD of programming? Constantly have to check the memory every cycle or the program will crash.

8

u/frankferri Jul 17 '20

is there a language in which this makes sense?

0

u/[deleted] Jul 17 '20

[deleted]

8

u/[deleted] Jul 18 '20

Liked the idea. Almost finished it. I'll go to sleep since it's 6:30 AM where I live, but I will publish it soon. I'll reply to this message.

7

u/[deleted] Jul 18 '20

Done. I added a little bit of spice to it.

2

u/SuperSupermario24 while True: print("owo") Jul 18 '20

That... actually sounds kinda cool.

6

u/vigbiorn Jul 17 '20

I have no clue. If there is, it's not a production language. I know at least the basics of the more common production languages. Or maybe a scripting language meant for small, fast processing. It would be a kind of efficient. No need for garbage collection if the space is guaranteed freed in a few cycles.

4

u/leonardishere Jul 17 '20

Possibly a hypothetical language with some kind of loop scoping. I hope such a language doesn't exist

1

u/frankferri Jul 18 '20

Poopity loopity scoop

7

u/timleg002 Jul 17 '20

I think its to show beginners, absolute beginners to show the value stays the same.. not sure why it wasn't a comment.. and they should understand that logic if they want to learn programming lol

2

u/Mr2-1782Man Jul 17 '20

There wasn't anything going through their head at that point. I see students make this mistake all the time. The blindly code without understanding what the code is suppose to be doing so they just throw ever condition in there because that's all they know.

1

u/[deleted] Jul 17 '20

this looks like a result of a student writing something that almost works, but without understanding how or why, and then changing things at random until the code works for the one input they have prepared. I wrote quicksort for class this way