Possible Duplicate:
How about newlines within comments ?

Shouldn't comments on StackOverflow be multi-line too?

Just like with posts. Sometimes it's difficult to discuss and present example code in comments to other people's posted answers

  • Closed as duplicate, but where is the link to duplicate?
    – studgeek
    May 11, 2011 at 16:53

2 Answers 2


If you're needing to respond to an answer with code, something has already gone wrong. If you're another answerer, edit and expand your original answer to include any code needed to fully explain your position. If you're the asker, edit your question. For anyone else, we actively discourage these discussions within a larger question. We want you to start or encourage the other user to start a new, focused, question and keep the original question on-topic.

  • well, if someone answers partially incorrectly and you want to point that out to him, so he can edit it or something, sometimes you need to post a code example that works, explaining why his doesn't the way he intended it to, for instance.
    – bevacqua
    Nov 8, 2010 at 17:41
  • 5
    No, either just edit the answer to correct the code or post your own answer with correct code. Nov 8, 2010 at 17:47

I think it should. Code snippets can be very useful for discussing an answer.

For example:

Hey, how about swapping the arguments like this?
function(rhs, lhs) { small snippet of code }

  • 5
    You can still do code formatting inside comments, so very small things fit in there just fine. "Try function(rhs, lhs) { // do work here }" would be a fine comment. Just use backticks around whatever you want to format like code. Apr 21, 2011 at 20:04
  • but that ain't pretty
    – bevacqua
    Apr 21, 2011 at 21:52
  • As @Nico says, and the question explicitly says newlines in comments (vs. just code in comments). Nico, upvote? Hoping to show folks have interest in having this work (vs the alternate opinion that its a bad idea).
    – studgeek
    May 11, 2011 at 16:52

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