DEV Community


Discussion on: 4 practices for better code

tux0r profile image

explaining an algorithm


Thread Thread
spikespaz profile image
Jacob Birkett

I think he's saying don't add comments on every single line.

/// Gets the last item index used in the current state.
size_t getLastIndex() {
    // Returns the last index.
    return lastIndex;

The doc comment at the top of the function already says what the last line if the function body is, yet I see things like this all the time.

Forem Open with the Forem app