Solidity theorytheory 0/50 · 0%
Types · easy

2. Value types

bool, uint/int, address, bytesN and enums.

Value types are copied on assignment: `bool`, `uint8`…`uint256`, `int8`…`int256`, `address`, `address payable`, `bytes1`…`bytes32` and `enum`.

`uint` is shorthand for `uint256`, the EVM's native word size, so it is usually the cheapest choice unless several small values can be packed into one storage slot.

uint256 total = 1_000;
int256 delta = -5;
address owner = address(0);
bytes32 root;
bool active = true;

There is no floating point. Money is held in the smallest unit — wei for ETH, or the token's own decimals.

Check your understanding

  1. 1. `uint` is an alias for which type?

  2. 2. How are fractional amounts represented?

  3. 3. Which type holds a 20-byte account identifier?