You might be smart enough to write a piece of code today, but you may not be smart enough 6 months from now. The very code you created will look foreign and non-understandable. So it better for one to comment or add descriptions to ones code. All programming languages provide a way to write comments in them. Comments are there for programmers reference, when the program runs, the comments are ignored as the computer does not need it to run the code.

Take a look at the program below:

# Temperature in Celsius
C = 30

#=
The following code below calculates the Fahrenheit
from Celsius
=#
F = ((9 / 5) * C) + 32

println(30, " C = ", F, " F")


It’s a simple program to convert Celsius to Fahrenheit. But notice here:

# Temperature in Celsius
C = 30


Here the things followed by the hash #, that is # Temperature in Celsius is a comment. In the above code I have given C = 30, in reality it would have been far better if I had given celsius = 30 as in today’s way of coding we expect a code to be as good to read as a comment. Any way I hope you now get an idea what an comment is.

The example shown above is a single line comment. I could have given it like this too:

C = 30 # Temperature in Celsius


Personally I prefer comments being in a separate line.

Now if you want to write long paragraphs, there is a thing called multiline comments. It starts with a #= and ends with a =# as shown below:

#=
The following code below calculates the Fahrenheit
from Celsius
=#
F = ((9 / 5) * C) + 32


You can find the source file for the program here https://gitlab.com/data-science-with-julia/code/-/blob/master/comments.jl.