diff options
author | Mircea Moca <mocamircea@gmail.com> | 2016-08-05 19:16:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-05 19:16:14 +0800 |
commit | 6846bb5dfde9d554e67b8b315188ffdf2871740c (patch) | |
tree | cff26682bbb743a4b1101aee3f3b024701b62d20 /docs/layout-of-source-files.rst | |
parent | 3c93a22d478b9439d6e226ad7954fe571117f439 (diff) | |
download | dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.tar dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.tar.gz dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.tar.bz2 dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.tar.lz dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.tar.xz dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.tar.zst dexon-solidity-6846bb5dfde9d554e67b8b315188ffdf2871740c.zip |
Update layout-of-source-files.rst
An example of natspec comment.
Diffstat (limited to 'docs/layout-of-source-files.rst')
-rw-r--r-- | docs/layout-of-source-files.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index a0170c5a..0d2970d4 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -157,3 +157,23 @@ You can use Doxygen-style tags inside these comments to document functions, annotate conditions for formal verification, and provide a **confirmation text** which is shown to users when they attempt to invoke a function. + +In the following example we document the title of the contract, the explanation +for the two input parameters and two returned values. + +:: + + /** @title Shape calculator.*/ + contract shapeCalculator{ + /**@dev Calculates a rectangle's surface and perimeter. + * @param w Width of the rectangle. + * @param h Height of the rectangle. + * @return s The calculated surface. + * @return p The calculated perimeter. + */ + function rectangle(uint w, uint h) returns (uint s, uint p){ + s = w*h; + p = 2*(w+h); + } + } + |