Possible Duplicate:
How do I format my code blocks?

I'm newbie to Stack Overflow as well as programming. I just wanted to know what is the best way to attach a code to a question.

I know that indenting by 4 spaces treats a line as code .. but if I have a block of code then its becoming a pain to indent each and every line by four spaces. Blocking a set and pressing tab also does not seem to work. I know that I'm missing something here.

Just wanted experienced users to shed some light on this.

marked as duplicate by Josh Darnell, amanaP lanaC A nalP A naM A, user7116, Shawn Chin, ale Jun 26 '12 at 15:32

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 Jun 26 '12 at 14:55

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


Mark some text in the question/answer editor, then press the "code" button on the toolbar ({}). It will indent your selection as necessary.