This thread is intended as a short help file for all those struggling to post formatted code on the forum.
Code block formatting
Posting formatted code on the forum (and most others) is as simple as selecting the code and pressing the </> button. It works the same as applying Bold or Italic styles to your document. It preserves indentation and applies syntax highlighting.
Note that all the </> button does is add three backticks ``` on the line before the code block and another ``` on the line after. If you wish you can type these rather than use the button.
Inline code formatting
Enclose the code snippet in single backticks, `...`.