# Comments in Dart Programming

Dart ProgrammingServer Side ProgrammingProgramming

#### Artificial Intelligence : The Future Of Programming

15 Lectures 54 mins

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### C Programming from scratch- Master C Programming

Best Seller

60 Lectures 8 hours

Comments are a set of commands that are ignored by the compiler. They are used in a scenario where you want to attach a note to your code or a section of code so that when you visit it later, you can recall it easily.

The comment statements are usually ignored during the execution of the program.

There are multiple types of comments in Dart, mainly these are −

• Single line comments

• Multi-line comments

• Documentation comments

We will explore all the above document types in this article.

## Single Line comments

Single line comments make use of // (double forward slash). They extend up to a new line character.

### Syntax

// this is a comment

### Example

Live Demo

void main(){
// var x = 10;
print("Hello World");
}

### Output

Hello World

## Multi-line comment

A multi-line comment makes use of /* */. Everything put between the opening /* and the closing */ will be ignored by the compiler.

### Syntax

/*
Inside comment
Also inside comment
*/

### Example

Live Demo

void main(){
/*
multi
line
comment
*/
print("Hello World");
}

### Output

Hello World

## Documentation Comment

The documentation comment is used in cases where we are generating reference for a project or software package.

### Syntax

/// This
/// is
/// a
/// documentation
/// comment
Updated on 21-May-2021 12:25:35

Advertisements