Comments

Comments are used to explain your code and they have nothing to do with the compiler. Compiler ignores your comment and do not consider them the part of your code. They just make your code more readable.

Types of Comments

  1. Single Lined Coments
  2. Multi Lined Comments

Single Lined Comment

Put two forward slashes before a line.

Multi Lined Comment

Put /* at the start and */ at the end.

  • If you do not want some lines of your code to execute, put them in comments.
  • To comment a line, click on that line to place cursor on that line and then press "Ctrl + /".
  • Comments are just used to increase the readability of your code.

Practice Exercises

Complete these exercises to reinforce your learning and earn XP

Sign in to track your progress and earn XP!
Exercise 1 of 2Easy

Which of the following is a best practice in programming?

10 XP~2 min
Exercise 2 of 2Easy

Code that is easy to read and understand is called ___ code.

10 XP~2 min