# Coding in replies

So if you want to put some code from a coding language like Python or JAVA, you can do this:

For Python Code:

python
print ("Hello World!")


NOT ANYMORE IT DOESN'T.

For Javascript code:

javascript


Every single letter or character of code is in the same color. So I guess it doesn't work. Please vote if I should delete it or not.

For C# code:

CSharp
string String = "Hello World!";
Console.WriteLine(String);


I don't know if this is supposed to happen, so I guess it's safe to say that it is sort of a success.

For JAVA code:

JAVA
System.out.println("Hello World!");


Nothing happened. Should we vote to delete this?

For C++ (or C) code:

C
#include <stdio.h>
int main(){
printf("Hello World!");
return 0;
}


The simple Hello World program but made tricky. Why did you have to do that, C developers...

Those are the only ones I know. Feel free to experiment tell me.
ALSO YOU NEED THE  PARTS AT THE END OF YOUR CODE!

I put all the code into preformatted text because the

[CODING LANGUAGE NAME]


bits would disappear.

##See? Now the "Python" bit has disappeared.
print("I can still write code and the reply will automatically")
print("color it.")

Also you can

a = "snap"
print(a)

Your examples don't clarify that you also need a line with (nothing but)  at the end.

I can't really add another  at the end, it won't show even with preformatted text on.

text
You're right


Fine, but anyone who reads your tutorial needs to know that they're needed!

foo bar
​​

​
this is my code
​


I was so confused for a long time, until I found out you stuck in an invisible character here

​
this is my code
​
^


You're looking at a new line character. They did it like this:

it's actually an invisible character, just look

This is not including the newline character. Here it is with the newline character

also,

as well as


Fun fact:
Just like with many programming languages,
Discourse uses \ for escaping characters.


\
Fun fact:
Just like with many programming languages,
Discourse uses \ for escaping characters.
\


I just fixed that.

There's also text for no formatting:

text
nothing here is formatted:
//moew
no comment formatting #mnbvcxzaqsewdfrgthuyjiklop
​​


Java is not an acronym, therefore it should not be capitalized.

bool coolPost = true;

void prettyNeat(int idSay)
{
dontYouAgree();
}
`

Well it normally is...

I meant that Java should not be written in all caps.

Python and

Javascript and

JAVA doesn't work...don't know why.