Sometimes
we need to pass our code so that someone else can see it and make some sort of
improvements. Sometime we just need someone else to tell us what we are doing
wrong.
Unfortunately,
not all programmers program the same. Each one of the does this artwork how
they believe is the best way to do it; this makes it almost impossible for
someone else to understand what we are doing in each line of code.
For this,
we use comments. You can add comments on a python file just by adding “#”
before what you try clarify. This way, your comment do not affect the
functioning of the program but it makes it clear to understand.
For
example, this is the code of a program without comment. As you can see, it is
hard to understand what is going on.
But
once we add the comments it’s easy to understand what´s happening on every line.
Just
remember, these comments DO NOT affect the code, so don´t be afraid to use them
more often.
No hay comentarios:
Publicar un comentario