Comments are sections of program text that are used for documentation.
Dart supports both single-line and multi-line comments.
A single line comment begins with the token //
. Everything between //
and the end of line must be ignored by the Dart compiler unless the comment is a documentation comment.
// This is where the app starts executing.
main() {
// Declare and initialize a variable.
var fullName = "Rock Star";
// Print to console
print(fullName);
}
A multi-line comment begins with the token /*
and ends with the token */
. Everything between /*
and */
must be ignored by the Dart compiler unless the comment is a documentation comment.
Note: Comments may nest.
/*
main top-level function
This is where the app starts executing.
*/
main() {
var fullName = "Rock Star";
print(fullName);
}