+ 1
When are comments used when you are coding
Im very new to coding and have heard about the importance of adding coments to the code, but i want to know when it is most useful to add them
1 Answer
+ 4
It takes a bit of experience to figure this out.
When you look at one of your codes a few weeks later and feel like someone else wrote it, and you'll think: 'Damn, an explanation would be nice...', then you'll get an idea.
You shouldn't overdo it. The first measure to produce understandable code is writing a good, clean, intuitive algorithm and give everything *good names*. Ideally, the code will explain itself like that.
And for everything that's still hard to figure out after that, you add a brief explanation.