Value types

A type is referred as value type if it holds the data (value) directly within the memory owned by it. These types have values stored with them, instead of elsewhere. The same is illustrated in following diagram. In this example, a variable of data type unsigned integer (uint) is declared with 13 as its data(value). The variable a has memory space allocated by EVM which is referred as 0x123 and this location has the value 13 stored. Accessing this variable will provide us with the value 13 directly:

Value types are types that do not take more than 32 bytes of memory in size. Solidity provides the following value types:

  • bool: The ...

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.