How do I format code with line numbers in the forum?

I have read a number of forum entries where the item contains code that has been entered using the ‘code’ surround and a few of them with responses containing line numbers referring to the correctly formatted code but that formatted code has no line numbers so is there a way to format code with line numbers?

I don’t think you can. You can always post a link to a site that does format code with line numbers, but normally I just count down to whatever line I’m looking for. Some people also put a comment saying “-- line 11” (or whatever line) to show where they’re having an error if they are having one.

1 Like

I would recommend not trying to include line numbers in your code on the forum. It makes it very hard to copy and paste when testing things to help solve your problem. Referring to code by pasting relevant code blocks should be perfectly sufficient.

2 Likes