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
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
spoiler
I love putting memes in comments :P