Data types in Solidity

Solidity data types can broadly be classified in the following two types:

  • Value types 
  • Reference types

These two types in Solidity differ based on the way they are assigned to a variable and stored in EVM. Assigning a variable to another variable can be done by creating a new copy or just by coping the reference. Value types maintains independent copies of variables and changing the value in one variable does not effect value in another variable. However, changing values in reference type variables ensures that anybody referring to that variables gets updates value.

Get Solidity Programming Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.