New to blockchain software development? Read my beginners guide here

How pragma works in Solidity

Created on May 2022 β€’ Tags: solidityethereumguides

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!

See all posts (70+ more)

See all posts (70+ more)

Was this post helpful? πŸ“§

If you liked this content and want to receive emails about future posts like this, enter your email. I'll never spam you.

Or follow me on @CryptoGuide_Dev on twitter

By using this site, you agree that you have read and understand its Privacy Policy and Terms of Use.
Use any information on this site at your own risk, I take no responsibility for the accuracy of safety of the information on this site.