diff options
Merge pull request #580 from Denton-L/docs-whitespace
Corrections to Documentation Spacing
Diffstat (limited to 'docs/structure-of-a-contract.rst')
-rw-r--r-- | docs/structure-of-a-contract.rst | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/docs/structure-of-a-contract.rst b/docs/structure-of-a-contract.rst index 0968ffc8..79f78422 100644 --- a/docs/structure-of-a-contract.rst +++ b/docs/structure-of-a-contract.rst @@ -21,12 +21,12 @@ State variables are values which are permanently stored in contract storage. :: contract SimpleStorage { - uint storedData; // State variable - // ... + uint storedData; // State variable + // ... } See the :ref:`types` section for valid state variable types and -:ref:`visibility-and-accessors` for possible choices for +:ref:`visibility-and-accessors` for possible choices for visibility. .. _structure-functions: @@ -39,14 +39,14 @@ Functions are the executable units of code within a contract. :: contract SimpleAuction { - function bid() { // Function - // ... - } + function bid() { // Function + // ... + } } :ref:`function-calls` can happen internally or externally and have different levels of visibility (:ref:`visibility-and-accessors`) -towards other contracts. +towards other contracts. .. _structure-function-modifiers: @@ -57,18 +57,18 @@ Function modifiers can be used to amend the semantics of functions in a declarat (see :ref:`modifiers` in contracts section). :: - + contract Purchase { - address public seller; - - modifier onlySeller() { // Modifier - if (msg.sender != seller) throw; - _ - } - - function abort() onlySeller { // Modifier usage - // ... - } + address public seller; + + modifier onlySeller() { // Modifier + if (msg.sender != seller) throw; + _ + } + + function abort() onlySeller { // Modifier usage + // ... + } } .. _structure-events: @@ -81,15 +81,15 @@ Events are convenience interfaces with the EVM logging facilities. :: contract SimpleAuction { - event HighestBidIncreased(address bidder, uint amount); // Event - - function bid() { - // ... - HighestBidIncreased(msg.sender, msg.value); // Triggering event - } + event HighestBidIncreased(address bidder, uint amount); // Event + + function bid() { + // ... + HighestBidIncreased(msg.sender, msg.value); // Triggering event + } } -See :ref:`events` in contracts section for information on how events are declared +See :ref:`events` in contracts section for information on how events are declared and can be used from within a dapp. .. _structure-structs-types: @@ -97,18 +97,18 @@ and can be used from within a dapp. Structs Types ============= -Structs are custom defined types that can group several variables (see +Structs are custom defined types that can group several variables (see :ref:`structs` in types section). :: contract Ballot { - struct Voter { // Struct - uint weight; - bool voted; - address delegate; - uint vote; - } + struct Voter { // Struct + uint weight; + bool voted; + address delegate; + uint vote; + } } .. _structure-enum-types: @@ -116,11 +116,11 @@ Structs are custom defined types that can group several variables (see Enum Types ========== -Enums can be used to create custom types with a finite set of values (see +Enums can be used to create custom types with a finite set of values (see :ref:`enums` in types section). :: - + contract Purchase { - enum State { Created, Locked, Inactive } // Enum + enum State { Created, Locked, Inactive } // Enum } |