2

Possible Duplicate:
How do I format my code blocks?

This newbie cannot figure out how to include code in a question. I'm getting a message saying I need to indent everything, but when I do still can't post. How do I post code and html with my question?

4
  • How to you indent your code? Could you post your question here?
    – Dennis
    Commented Feb 4, 2013 at 14:23
  • 1
    Did you select all the code and then click on the {}icon? Or hit ctrl+k?
    – Bart
    Commented Feb 4, 2013 at 14:23
  • 2
    stackoverflow.com/editing-help#code ... that's all there is to it, really.
    – Felix
    Commented Feb 4, 2013 at 14:26
  • I'm really thinking we could do better than the "please indent code" notification, seems like we get a question like this once a week...
    – Zelda
    Commented Feb 4, 2013 at 14:55

1 Answer 1

2

Read this https://stackoverflow.com/editing-help#code

To add code you need four spaces added in front of all of your code. An easier way to do this is to highlight all of your code and then hit the button that looks like {}.

Here is some example code

print("Example code")
2 + 2
sqrt(2^2) == 2

You can 'edit' this post to see the actual markdown used to render it to get an idea of how to format the code properly.

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