Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested multiline comments in Dart

Tags:

comments

dart

My code contains lots of documentation comments written in the multiline comment syntax like in example

/** 
 * This class is used as an example.
 *
 * To ask about multiline comments.
 */
class A {
}

/**
 * Another example class with comment.
 */
class B {
}

Sometimes, during debuging/refactoring or experimenting with the code, I want to comment out some blocks of the code. In this example, I would like to comment out the classes A and B. Is there a way to do this in a simple way without a need to watch where the documentation comments starts and ends and also without a need to comment each line separately with one line comment syntax //?

like image 433
Samuel Hapak Avatar asked Sep 09 '13 07:09

Samuel Hapak


1 Answers

Dart (contrary to other C-like syntax languages) natively supports nested multiline comments.

So you can just write

/* Commented for debugging purposes!!! Do not forget to uncomment!!!
/** 
 * This class is used as an example.
 *
 * To ask about multiline comments.
 */
class A {
}

/**
 * Another example class with comment.
 */
class B {
}
*/

And do not care about some nested comments inside the comment block.

like image 154
Samuel Hapak Avatar answered Oct 23 '22 01:10

Samuel Hapak