DEV Community

Yassine Chraa
Yassine Chraa

Posted on • Updated on

Solidity Data Types

Image description

  1. Values Types:
    • uint(Unsigned Integer), uint8,..., uint256
    • int, int8,..., int256
    • bool(Boolean)
    • address: use to stock Ethereum address
    • bytes: Holds a 30 byte value
    • enum: The data representation is the same as for enums in C example: enum Countries{ Morocco, CANDA, ESPAIN};
    • function: There are three types of functions; pure, view and payable
  2. References Types:
    • Arrays: uint[] memory a = new uint[](7);
    • Data Location: There are three data locations; memory, storageand calldata.
    • struct: used to create new types
struct Funder {
    address addr;
    uint amount;
}
Enter fullscreen mode Exit fullscreen mode

3.Mapping Types:

  • Syntax: mapping(KeyType => ValueType) VariableName;

Top comments (0)