Imagine you have developed a large app in Python that consists of over 1,000 lines of code. But wait! You have noticed a bug. But where is the offending code? All you see is a lake of confusing code.
Do you see a problem? To make your code easier to read, it is important to include code comments. These are parts of your code which can be human readable. The computer just ignores these when it sees them, so you can put whatever you want in them.
In addition, comments can help you to organise your code and make it clearer. For example, if you have a large operation with many steps, you could split it up with comments labelling each step and what it does. That way you can identify where something is going wrong if you notice a bug in the program.
In python, any line which begins with a hashtag is a comment. In Java, you can make a line a comment with a double forward-slash. For example:
//This is a comment
In most editors, comments are highlighted green. In IDLE, they are highlighted red.
So, there you have this week’s top tip. So now, go and get coding, and don’t you forget those comments!