#07 - What are Comments


Let's consider a English movie ,We can see some sentence running in the bottom of the screen , which is know as SUBTITLE. If the subtitle has any mistake , or if is in no sync, it doesn't affect the movie right? Subtitle is used for the understanding of the viewers . If we remove them, the movie still runs.

Similarly, Comments in programming is nothing but a subtitle used for the understanding of the programmers or someone who sees the code. These comments are not complied by the interpreter, when it see a comment it just skips it.

You may think , "I know what I am doing , then you do I need comment!?" If you are creating a program, you may remember everything, but after a week or a month , you cannot remember those logics, everything will be just vanished, so we use comments in such situation. Moreover when you are developing something , you may give it to some other developer , for the understanding of them we use comments.

Ok , let's see how can you comment a line. It's so simple , just use hash symbol (#) at the starting of the line. That's it you have commented a line :)

We also have multiline comment. Consider a situation where you need to comment more than one line, then you need a multi line. How can we do multiline comment? It is so simple
Just enclose the lines with triple quotes(''' '''), that's it :D

EXAMPLE:

  1. #this is a single line commenst , these lines are skipped by the interepreter
  2. ''' this is a multiline comment
  3. we can comment more than
  4. one line using triple quotes
  5. '''