I am torn between two worlds on this one. When answering a question, I like to post clean, minimal code. However, sometimes that code may not be entirely clear to the original asker and it can be difficult to explain each line within the body of the answer itself.
Therefore, I will often place comments throughout the code in my answer, explaining what the code does and why we do it that way. This, obviously, can lead to some longer answers and may be more confusing due to all the extra text.
So, is there a standard in place here for this? Should our code be completely void of comments and just demonstrate the concepts and procedures involved? Or can the code itself be a part of the answer with the comments within it?
My answer on this question may help illustrate the situation. I worried that my initial, code-only, approach may not have been clear for someone that is new to coding so I repeated the code later with the additional comments.
Note: I am not suggesting our answer should consist of ONLY code with comments (such as this question), but just whether it is bad form to post answers with more information within the code. I do still believe some explanation should be given outside code as well.