Solidity – Comments

Solidity - Comments

This topic is about Solidity – Comments.

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.

Example

The following example shows how to use comments in Solidity.

function getResult() public view returns(uint){
   // This is a comment. It is similar to comments in C++

   /*
      * This is a multi-line comment in solidity
      * It is very similar to comments in C Programming
   */
   uint a = 1;
   uint b = 2;
   uint result = a + b;
   return result;
}

In this topic we learned about Solidity – Comments. To know more, Click Here.

This Post Has 2 Comments

Leave a Reply