8

This question already has an answer here:

This is a simple question. I'm trying to enter code on Stack Overflow so I can ask people questions about my site. Stack Overflow says I have to indent or something to show my code. I've tried pressing the Ctrl+K command, and it does give me a "insert code here" but when I put the code between the " " it still gives me an error saying I can not post my code. This is becoming very frustrating being that I can't ask any questions on this site because the first thing people want is code, and without that my posts are just ignored.

marked as duplicate by Martijn Pieters, ale, Servy, Mat, user213963 Jan 16 '14 at 21:50

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.

migrated from stackoverflow.com Jan 16 '14 at 21:34

This question came from our site for professional and enthusiast programmers.

9

There are several ways of doing it:

  1. Press space four times and start writing or pasting your code.
  2. Paste your code and go to the far left of it and press space four times and you should see a gray block.
  3. You can also use the curly brackets to create a code block, you do this by selecting the text you want to include in the block and then you press the curly braces above.

General pointer

It is also good to write some text around every code block to explain its functionality. You should also be aware that you can make certain parts of your text bold to visualize important details. This is done by pressing the B up on the kitchen sink.