Types and Control for Smart Contract Developers
Types and control flow in Solidity cover how data is declared, stored and used. Value types such as uint256, address and bool differ from reference types such as arrays, structs and mappings, and each has a data location: storage, memory or calldata. Expressions, conditions and loops then act on these values, with attention to overflow and gas.
Stage: Solidity Language · Part of the Smart Contract Developer roadmap · Last reviewed 19 November 2026
What to learn in Types and Control
- Choose between uint, int, address, bytes and string for a given field
- Use mappings, arrays and structs to model on-chain data
- Explain storage, memory and calldata and when each applies
- Write conditionals and loops while keeping gas cost bounded
- Handle integer overflow, which reverts by default since Solidity 0.8
Types and Control interview questions
What is the difference between storage, memory and calldata?
Storage is persistent contract state and is the most expensive. Memory is temporary data that lasts for the call. Calldata is read-only input data for external function arguments and is cheaper than copying to memory. The location affects both behaviour and gas.
Why can unbounded loops be a problem in Solidity?
Each iteration consumes gas and a block has a gas limit. A loop over a growing array can eventually exceed it, making a function impossible to run and possibly locking funds. Prefer bounded work, pagination or pull-based designs.
Where Types and Control fits in the Smart Contract Developer roadmap
Types and Control belongs to the Solidity Language stage (intermediate level), which takes about 33 hours. The language in depth.
Other units in this stage
Back to the full Smart Contract Developer roadmap