How to add code in this forum

What is the correct way to add code to a post in this forum?

Paste in your code, highlight it, and then click on the </> button on the toolbard right above where you are typing.

Then your code will look like this:

Var m as New someClass
m.priorityInt = 1
2 Likes

Thanks @Mike_Cotrone

My problem was that I did not have a blank line after my comments between the code.
Thanks

1 Like

and is it possible to upload a simple project here ? or do we still have to use 3rd party hosting site ?

@Jean-Yves_Pochez You can only upload images directly from your computer (or web) by using the “picture” button on the toolbar above your text. For Xojo projects you still need to link to an external repo like Dropbox for example.

picForum

1 Like

@Gary_Smith …thanks for asking this too ! :ok_hand:t2:

There are two other ways to post code in this forum in addition to @Mike_Cotrone’s method.

For inline code you just flank the text with the backtick character (`) like so:

Here is an `inline code` sample.

Gives this:

Here is an inline code sample.

You can also surround code in a code fence. A code fence is three backticks on one line (optionally suffixed with the language to highlight - e.g: ```xojo), then your code and finally terminated with three backticks (```) on their own line, like so:

```xojo
Var i As Integer = 42
i = i + 1
```

Will give you this:

Var i As Integer = 42
i = i + 1
3 Likes
 testing backtick "+xojo" (from "my" KB : Alt+7  )

:ok_hand:t2: :100:

1 Like

Hmmm, four spaces also seems to do it, thus:

Var i as Integer
i = i + 1

Yep. That’s standard markdown too. You can also replace backticks with tildes if you prefer.

Test ‘’‘dim i as integer’’’

Looks like the required character isn’t on my keyboard… :thinking: