1174
Comenting code (lemmy.ml)
you are viewing a single comment's thread
view the rest of the comments
[-] Presi300@lemmy.world 4 points 1 month ago

What I usually do is I explain what the function does and, if not self explanatory, explain why it does such thing. Like, with the clock example, I'd explain that it tells the time and then, if not immediately obvious, explain why the time needs to be known... Smth like that.

There is no "correct" way of commenting code. I personally think the more verbose, the better, but that's an unpopular opinion afaik. As long as the code can be understood, the comment is doing it's job.

PS, I'm also kinda new to programming, mostly doing JS and React stuff

spoilerI love putting memes in comments :P

this post was submitted on 28 Sep 2024
1174 points (98.9% liked)

Programmer Humor

32483 readers
560 users here now

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

Rules:

founded 5 years ago
MODERATORS