DEV Community

Cover image for Day 2 - Comments and NatSpec
Vedant Chainani
Vedant Chainani

Posted on • Edited on

Day 2 - Comments and NatSpec

This is Day 2 of 30 in Solidity Series
Today I Learned About Comments and NatSpec Format in Solidity.

Solidity supports both C-style and C++-style comments, Thus −

  • Any text between a // and the end of a line is treated as a comment and is ignored by Solidity Compiler.
  • Any text between the characters /and/ is treated as a comment. This may span multiple lines.
// This is a Single Line Comment

Enter fullscreen mode Exit fullscreen mode
/*

This is A Multi-Line Comment 
It can also Include Emojis 😃

*/

Enter fullscreen mode Exit fullscreen mode

NatSpec Format

Solidity contracts can use a special form of comments to provide rich documentation for functions, return variables and more. This special form is named the Ethereum Natural Language Specification Format (NatSpec).

/// This is NatSpec Single Line Comment
/// @title This is a Title
/// @author Author Name
/// @dev Please use this in this way
Enter fullscreen mode Exit fullscreen mode
/**
This is NatSpec Multi Line comment
This is Line 2
And so on....
*/
Enter fullscreen mode Exit fullscreen mode

More on NatSpec - here

GitHub logo envoy1084 / 30-Days-of-Solidity

30 Days of Solidity step-by-step guide to learn Smart Contract Development.

Solidity

WARNING: This repository is currently undergoing updates and revisions to incorporate the latest information and advancements in Solidity programming. Please be advised that the content may not be up-to-date or accurate during this time. We expect the updates to be completed within the next 30 days, and appreciate your patience during this process. Thank you for your understanding.

Contents





Top comments (1)

Collapse
 
yongchanghe profile image
Yongchang He

Thank you for sharing!