cover

Comments in Dart #

Comment is a verbal or written remark expressing an opinion or reaction. This definition is based on the dictionary. You can relate dart comment or any programming language comment with this.

Comment is remark, When we mention some text along with the code for future reference.

In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program.

Single line comment #

main.dart
void main(){
    // print is function which print message on console.
    print('Comment Lesson');
}

Multiline comment #

main.dart
void main(){
    /* Multiline Comment starts using slash followed by asterisk
    Comment Line 2
    Comment Line 3
    Multiline Comment finish using asterisk followed by slash */
    print('Comment Lesson');
}

Optional #

main.dart
void main(){
    print('Comment Lesson');    // This line has code as well as comment.
}

Comment never produces error if it does there is something wrong with that programming language.