R Comments

Comments are generally written in the program to explain what a piece of code does. It informs other programmers more specifically about what is the logic behind that piece of code. It is generally a helping text. It makes code more readable.
These comments are completely ignored by the compiler. In R language comments start with #.

Types of Comments in R

There are three types of comments.

1. Single-line Comments

The type of comments which are written in one line. In the below example when we will execute the code will not get any output because the given statement is a comment hence it will be ignored by the compiler.



2. Multi-line Comments

Comments that are written in multiple lines.

As we know that R language does not support multiple line comments but to make programming easier it supports commenting multiple single lines together. This can be simply done by just inserting # before each line to create multiline comments.

#Welcome to R Programming Language
#This is my first program in R Language

Note: R does not support documentation comments.