loading...

Comments in D

github logo ・1 min read

Python (14 Part Series)

1) Boolean in D 2) Comments in D 3 ... 12 3) Raise Exceptions in D 4) Add to a List in D 5) Count of a List in D 6) String Contained in a String in D 7) Where did my string go in D 8) Case Insensitive in D 9) Add to a Dictionary in D 10) Check Dictionary has key in D 11) Filter a Dictionary in D 12) Split, Apply, Merge in D 13) Map Reduce in D 14) Skip the first line of a file in D

In my continued attempts to write in Python, I desired to comment out some code. I tried an assortment of styles including ; but I still had to search because I had forgotten #

D follows the C++ comments.

// single line
/*
  Multi-line
*/

It goes a step further with nested comments.

/*
/*
  Multi-line
*/
This is not a comment 
*/

/+
/+
  Multi-line
+/
We are still a comment
+/

If you place an additional character in the comment start, then these comments are eligible for documentation generation.

/// Document comment
/** doc comment */
/++ comment for docs +/

Well D does not stop there and provides a different way to prevent code from compiling.

version (none) {
    auto var = 85;
}

It is still run through the parser, but otherwise is not required to compile successfully.

twitter logo DISCUSS
Classic DEV Post from Apr 29 '19

Are we pretentious and arrogant?

Do you think that we, as developers, have a slighly tendency to become quite selfish because of our so specific-skills?

Jesse Phillips profile image
Senior Quality Assurance (SDET) starting to establish a larger presence in communities.

The only way to keep up with JavaScript trends is with the help of community.

Join dev.to ❤️