How to put code in a proper way in the question

I am trying to put my code along with one of my question.
But the code gets messed up and unreadable. All spaces and new lines are gone.
How to put the code in a proper way?

The code gets messed up because the editor follows Markdown formatting. When the editor is active, you’ll notice a box appears on the right titled “Markdown Basics”. Follow the link at the bottom to learn more about Markdown.

If you don’t want to bother with that however, there are a bunch of formatting options above the text box, including one button for code marked “101010”. You can use that. Alternately, since HTML tags are also supported, you can enclose your code in the

 tag.

PS: It’s nice that you actually bothered to ask about it, many people just leave their code like that :slight_smile:

2 Likes