How pragma works in Solidity
A guide to understanding and writing the pragma visioning in Solidity
Table of Contents for How pragma works in Solidity
At the top of Solidity files you have to define what version of the compiler your Solidity file is written for.
Allow only a specific version of the Solidity compiler:
pragma solidity 0.8.4;
Allow a range of Solidity compiler versions
You can use less than/greater than signs to denote a range of versions that your code is valid for.
pragma solidity >=0.8.4 < 0.9.0 ;
Allow a minimum version of the Solidity compiler
Use the caret (^
) to define a minimum version.
pragma solidity ^0.8.4;
Spotted a typo or have a suggestion to make this crypto dev article better? Please let me know!
Previous post
π Solidity Auditing online quiz
Learn how to audit smart contracts by looking at some example code and trying to find the bugs
β½ Solidity Gas Optimizations Guide
How to optimize and reduce gas usage in your smart contracts in Solidity
π§ͺ Guide to testing with Foundry
Guide to adding testing for your Solidity contracts, using the Foundry and Forge tools
π Guide to UTXO
UTXO and the UTXO set (used by blockchains such as Bitcoin) explained
π Solidity Assembly Guide
Introduction guide to using assembly in your Solidity smart contracts
π¦ Ethereum EOF format explained
Information explaining what the upcoming Ethereum EOF format is all about