file_structure.rst 659 B

1234567891011121314
  1. File Structure
  2. ==============
  3. A single Solidity source file may define multiple contracts. A contract is defined
  4. with the ``contract`` keyword, following by the contract name and then the definition
  5. of the contract in between curly braces ``{`` and ``}``.
  6. .. include:: ../examples/multiple_contracts.sol
  7. :code: solidity
  8. When compiling this, Solang will output contract code for both `A` and `B`, irrespective of
  9. the name of source file. Although multiple contracts maybe defined in one solidity source
  10. file, it might be convenient to define only single contract in each file, and keep contract
  11. name the same as the file name (with the `.sol` extension).