Comments in Dart

What are comments?

Comments are sections of program text that are used for documentation.

Dart supports both single-line and multi-line comments.

Single line comment

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);
}

Multi line comment

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);
}