What is the good of a comment in a code?


#1


Replace this line with your code.


#2

I didnt understand much from 14/15.


#3

why do we have to delete old code to experiment with new one?


#4

Comments are script, that the users never see. Alot of programmers use it as a ToDo list or just to say something important. As an example

#There is something wrong, the output must be True
def funtion_that_must_return_true
      return False

So the other programmer sees the comment, and fixes it.

#There is something wrong, the output must be True
def funtion_that_must_return_true
     return True

#Fixed, now it returns True

alot of people also use comments as a notebook.

#My code, that returns True

#There is something wrong, the output must be True
def funtion_that_must_return_true
     return True

#Fixed, now it returns True

Sorry for writing python, I don't know HTML that much.


#5

A comment is something that the computer won't read, but humans can read it. It helps other coders to quickly figure out what does what. So you could say that this does this and that does that. So other people who are not familiar with your code will be able to decipher it faster.


#6

Basically comments are so that you can talk to yourself or other programmers in the future. Comments tell you what different lines of code are for.

Whenever I get files like .cfg files, then I sometimes want to edit them. People will often leave comments in the code which helps whenever I want to edit the file.

It's good to make a habit of writing comments early in programming. You may make a program as a less experienced programmer, and then come back in the future and not understand any of the code because you didn't leave any comments.


#8

hello everyone firstly thanks for the time you've spent
can you send some pictures of examples in HTML format
have a nice day


#9

A single line comment in HTML looks like this

<!-- This is a single line comment! The next line will be code, no need to close this. -->

A multi-line comment looks like this

<!-- This is a multi-line comment! You must remember to close this
or everything under this comment will not work, and you will get
errors. -->

#10

Nope. HTML:

<!-- Single -->
<h1>Code</h1>
<!--
Multi
line
-->

What you did was CSS :wink:


#11

I feel so silly, you're right. Memo to self: Get some sleep. :laughing:


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.