Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Possible Duplicate:
How do comments work?

How do I add code while writing comments and how do I enter a newline character?

share|improve this question

marked as duplicate by Michael Mrozek, Grace Note, Pops, Kev, ChrisF Jan 12 '11 at 20:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Writing what comments? Not sure I understand – Pëkka Jan 12 '11 at 18:41
While commenting to an answer / question.. When i hav to include a code sample, there s not formattin option lik available for asking a question – CHID Jan 12 '11 at 18:43
Like this: This is code. – John Jan 12 '11 at 18:44
You don't add newlines in comments. If you want to post that much code edit your question (or answer) or post an answer. – ChrisF Jan 12 '11 at 21:21
wait, so you can't write code in comments with more than 1 line? – Charlie Parker Jun 20 at 19:32
up vote 17 down vote accepted

You can't put newlines in a comment codeblock, but you can do inline code by using the backtick character. It looks like this


and it appears below the escape key on most keyboards which is sometimes the same key as the tilde (for example, on US English keyboards):


Surrounding something in backticks lets it appear as an "inline code block" and you could put them almost anywhere you like, even breaking across new lines. int c; c++; sprintf(); but notice there's no coloration, of course.

E.g. typing `something` in the editor produces something on the page

share|improve this answer
thank you. @drachenstern – CHID Jan 12 '11 at 18:46
Better to upvote or accept, but I'll take the thanks for now ;) – jcolebrand Jan 12 '11 at 18:47
is that the character Yes it works thank you ! – Faizan Dec 30 '12 at 13:22
testing thank you – Mansoorkhan Cherupuzha Aug 27 '14 at 10:28
test code not code – Marek Sep 23 '14 at 6:58
'something' this is a test – Tyler Nov 30 '14 at 12:07
~something~ this is another test – Tyler Nov 30 '14 at 12:08
one more time , cool – Tyler Nov 30 '14 at 12:08
this is just a test – kimreik Jan 11 '15 at 0:54
you need to place the symbol just before the letter, and no spacing between the back quote and starting letter. ` FYI` :P – ravi.zombie Dec 15 '15 at 2:10
test code in comments – Umar Jun 26 at 7:44
Thanks. I thought they meant the single quote '. Luckily I found this answer in under 4 minutes or I could have earned the "Can't tell a backtick from a single quote" badge. – Elise van Looij Jul 9 at 15:58

Place this symbol: ` before and after the code. (On many keyboards, this "backtick" is the button to the left of "1".)

share|improve this answer
thank you. @john – CHID Jan 12 '11 at 18:46
@CHID: like drachenstern said, better to upvote or accept. ;) – John Jan 12 '11 at 18:48
¨ds¨ test vfdsfds – Dejo Dekic Jan 28 at 22:00

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