this post was submitted on 08 Jul 2023
133 points (94.0% liked)

Programmer Humor

32061 readers
1011 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 14 comments
sorted by: hot top controversial new old
[–] devious@lemmy.world 19 points 1 year ago (1 children)

I once worked with a senior dev who wrote all his array iteration for loops with no condition e.g "for int i = 0 ;; i++" and added an "if i == array.length then break" type condition to the end of every block... And he genuinely didn't see this as a problem at all.

[–] LeylaaLovee@lemmy.fmhy.ml 12 points 1 year ago

This was something I did in school to fuck with the teacher. He said all he cared about was output so as long as the code all worked, we could make it as stupid as we want. He taught us really good basics though. Really encouraged us to learn more about coding ourselves so that we could make the next best shitpost for the class. My favorite was creating stupid arithmetic functions. What the fuck is i++? I only know the function increaseIByOne

[–] mcherm@lemmy.world 14 points 1 year ago (1 children)

It really needs a fourth block that just says "Python".

(For those who don't get the joke, in Python the way that one exits a loop over an iterator is to keep going until the iterator throws an exception. It sounds dumb at first, but in truth, that's only if you think that exceptions are incredibly heavyweight compared to other operations.)

[–] lowleveldata@programming.dev 13 points 1 year ago (2 children)

Wait till you find out you can do everything with recursion

[–] karbonkel@beehaw.org 5 points 1 year ago

Haskell has entered the chat

[–] mvirts@lemmy.world 1 points 1 year ago (1 children)
[–] walthervonstolzing@lemmy.ml 1 points 1 year ago

Not in every language, though.

[–] aidan@lemmy.world 7 points 1 year ago

If you think about it, while-true is just goto

[–] PeterPoopshit@lemmy.ml 6 points 1 year ago* (last edited 1 year ago)

Segmentation fault (core dumped) is fun guys

[–] nothendev@sopuli.xyz 3 points 1 year ago

try-while block

[–] humbodungo@lemmy.world 2 points 1 year ago

So, python ?

[–] johnofthesea@lemm.ee 1 points 1 year ago
load more comments
view more: next ›