📜  Solidity-评论

📅  最后修改于: 2020-11-04 03:10:52             🧑  作者: Mango


 

Solidity支持C风格和C++风格的注释,因此-

  • //和行尾之间的任何文本均被视为注释,并且被Solidity Compiler忽略。
  • 字符/ *和* /之间的任何文本均被视为注释。这可能会跨越多行。

以下示例显示了如何在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;
}