DART – Comments
A comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters.Wikipedia
Types of Dart Comments:
- Dart Single line Comment.
- Dart Multiline Comment.
- Dart Documentation Comment.
Dart Single line Comment
Dart single line comment is used to comment on a line until a line break occurs. It is done using a double forward-slash (
//This is a Single Line Comment
Dart Multi Line Comment
Dart Multiline comment is used to comment out a whole section of code. It uses ‘
/*’ and ‘
*/’ to start and end a multi-line comment respectively.
/* This is a Multi line Comment */
Dart Documentation Comment
This is a special type of comment mainly used to generate documentation or reference for a project/software package. Documentation comments are multi-line or single-line comments that begin with
/// on consecutive lines has the same effect as a multi-line doc comment. The brackets are used to refer to classes, methods, fields, top-level variables, functions, and parameters. The names in brackets are resolved in the lexical scope of the documented program element.
/// This is a Example Of Documentation Comment /// Dart is cool
In the next lesson, you will learn about Keywords.