2.3.12

Comments

Test yourself

Comments

Comments are lines of code that are ignored completely by the computer.

Illustrative background for What are comments?Illustrative background for What are comments? ?? "content

What are comments?

  • A comment is a line of code that is completely ignored by the computer.
  • Comments can be used to add description to your code to make it easier for other people to understand.
  • They can also be used to leave notes and reminders to yourself as you work on a complex program.
Illustrative background for How to commentIllustrative background for How to comment ?? "content

How to comment

  • To write a comment in most languages, you must use a special character which tells the computer to ignore the rest of the line:
    • In Python, that character is a #.
Illustrative background for InterfacesIllustrative background for Interfaces ?? "content

Interfaces

  • An interface is a collection of comments which describe a subroutine.
  • An interface includes:
    • List of parameters and their types.
    • Return value and its type.
    • What the subroutine does.

Jump to other topics

1Computational Thinking & Algorithms

2Programming

3Hardware & Software

4Data

5The Internet

6Online Safety & Security

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson