Comments

Writing Comments

To annotate your work, you can write a comment using the # symbol. Comments are ignored when you run the program and not printed.

comment

Programmers use comments to explain to other people (and themselves) what different sections actually do. With huge programs comments are vital otherwise it would be too confusing. If you are creating Computer Science coursework, you will need comments to explain you understand and have written your own code!

Have a lot to say in one comment? Use ”’ at the start and ”’ at the end like below:

comment2.PNG

Top Tip: Use multi-line comments when testing a program to ‘blank out’ sections that you know work fine and only focus on one part at a time.

Practice Task 1

< Back to Section One