What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

I like stackoverflow because there are so many talented people helping each other out. I would like to know what is the best way to respond to a suggestion to my question, i.e., sharing the code changes from the suggestions. Do I post it as an "answer"? or do i post it as a comment? how would formatting be for Code in a comment?

share|improve this question

2 Answers 2

Code doesn't format well in comments.

If the new code answers the question directly, post it as an answer, with explanatory text included. But I would only do this once. Don't repeatedly post answers showing revisions to the code.

If the code merely clarifies an existing answer, or consolidates suggestions by several answer posters, I would put the new code at the bottom of the question, separated by a line, like this:


Here is my final code:

my foo(is barred)
{
    // I do things here
}
share|improve this answer

You could put it as an update to your question. If you mark that section of your question as Update and then put the code changes below it, there should be a clear delineation between your original question and the updates you received from people. This should also format much better than attempting to put code in a comment.

Just my opinion, of course...

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .