this post was submitted on 02 Oct 2023
1532 points (98.4% liked)

Programmer Humor

32495 readers
670 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] SocialMediaRefugee@lemmy.ml 2 points 1 year ago* (last edited 1 year ago)

Yes, two of the most important things I see comments do is explain things like boundary conditions, "This is why we stop at 50 here." and historical reasons "We have to return a 1 here because we still use calling func FOO for all of our calls still and it expects 1 as the default..."

Another helpful use is to describe the expected format of the input. "We expect a struct with this format here..." Stick in a small example too. It makes it so much easier to quickly scan the code's flow.