One important thing in programming is to make
your code easy to read and easy to understand.
It shouldn't take long for someone else to
get what your code is about and what it does.
So in addition to make your code as clean as
possible, you can add what we call comments
in order to add some notes to your code so you can explain some
parts or simply tell what you're going to do next in your program.
To create a comment, this is very easy. You just
use the hashtag sign and then whatever is after this
is going to be a comment. So this is a comment and
as you can see here in the IDE, this is going to
be in gray. If I run the program, so stop and rerun, if I run the program,
you can see here the line "This is a comment"
is not executed. So for example, you could add a
comment here to say username, let's say "Ask
the username" and then another comment which is.
"Ask the user age" and then let's say "Print username and age".
If you want, you can also add a comment at the
end of the line. So whenever you start a comment,
whatever after this is going to be a comment
but before is going to be a valid instruction.
You can also, if you want, comment a line. If I
comment "This", it means simply that this is not
going to be executed. So I can just run the program, what is your name, how old are you
and then you can see we don't have the print. We
don't have "Hello username" because I have commented
this line. So when you comment a line, it's not
going to be executed. That can be very useful
when you want to test some code. You can comment
a line to test without this instruction and then
uncomment to test with your instruction. So to
recap on comments, first of course make your code
as clean and as easy to read as possible and then
you can add comments to make it easier to understand
what a certain part of your code does or maybe
add some warnings for any other developers who
would like to modify this code in the future or
well just anything you want if it can make the code easier to read.