Whenever I ask a question on Stack Overflow and I wish to respond when someone gives an answer, I only seem to have the option to add a comment.

How do I make a comment which is multi-lined, so I can reply back with code snippets or results, etc.?

  • for example here is a comment I am adding , but if I try to add code, void helloWorld(void) { } it removes line breaks
    – Ashod Apakian
    Nov 22 '12 at 9:25
  • void helloWorld(void) { }
    – D J
    Nov 22 '12 at 9:28
  • say my question involved 10 lines of code, and someone made a response which I wanted to respond to with some of his code changed.. how do I do this for the 10 lines of code in question via the comment
    – Ashod Apakian
    Nov 22 '12 at 9:31
  • Possibly related: meta.stackexchange.com/questions/156606/code-in-comments
    – user200500
    Nov 29 '12 at 18:12

The ideal place for:

  1. Code snippets that clarify a detail in your code or why the code in an answer doesn't work
  2. Content that aggregates knowledge you have gleaned from the answers, without reaching a definitive solution

is your question.

Think of it this way: if the absence of the comment would mean the page loses something significant in terms of narrative clarity (how the OP and answerer got to the solution), or in terms of information present, then it probably doesn't belong in a comment anyway.

  • Consider this case: If what I'm saying is answer-relevant, but is a clarification that would not make sense in the context of what the original answer was trying to say, but nonetheless is vitally useful to the author of the original answer since it may or may not run into unforeseen issues that arose in another context, e.g., consider the line breaks in stackoverflow.com/questions/11248073/… in which linebreaks are crucial to understanding the intended meaning as a sequence of returned statements.
    – mpacer
    Aug 4 '15 at 6:45
  • What about someone else who is not the OP?
    – user118967
    Aug 7 '19 at 21:28

You must log in to answer this question.