Index

Solidity

  1. types
  2. External
  3. Library
    1. self in Library
    2. using * for
    3. self example
  4. interfaces
  5. import
  6. msg.value
  7. Handling ether
  8. Erc20 token in contract
  9. assembly
  10. Enum
  11. memory, storage, calldata
  12. Array Pushing
  13. length in array
  14. Struct array
  15. mapping
  16. bytes and string
  17. uint to bytes32
  18. returns with name
  19. score voting
  20. Tests
    1. Async Tests
    2. Hooks

types


Value Types:

The following types are also called value types because variables of these types will always be passed by value, i.e. they are always copied when they are used as function arguments or in assignments.

Value types are:
1) booleans: bool
2) Integers: int/ uint

uint and int are aliases for uint256
Keywords uint8 to uint256 in steps of 8

3) Address
The address type comes in two flavours, which are largely identical:

address: Holds a 20 byte value (size of an Ethereum address).
address payable: Same as address, but with the additional members transfer and send.
The idea behind this distinction is that address payable is an address you can send Ether to, while a plain address cannot be sent Ether.

Type conversions:

Implicit conversions from address payable to address are allowed, whereas conversions from address to address payable must be explicit via payable(<address>).

4) String
Strings hey are implicitly convertible to bytes1, …, bytes32, if they fit, to bytes and to string.
6) Hexadecimal Literals
7) Enums
8) Function Types


Reference Type
Reference types comprise structs, arrays and mapping