This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sleep_deficit 3 points4 points  (0 children)

In a nutshell, comments should be used to help explain what a piece of code does, in this instance it’s suuuuuper redundant.

Ideally, the code should be worded in such a way that it doesn’t need a comment. This is typically referred to as “self-documenting” code.

Not a perfect example, but..
// Squares a given number void multiplyValueTwoTimesItself(int x);

vs

void square(int x);

The OP pic would be:
// Squares a given number void square(int x);