Why does solidity (*sol) file starts with pragma? What does pragma stands for and its origins?

2 Answers 2


The version pragma is included because future versions of solidity will likely not be compatible with the current 0.4.* version. Specfically, 0.5.0 will likely have breaking changes.

Pragma was borrowed from other languages, such as C and C++, that use it as a preprocessor directive.

  • Compiler directive I believe, but yes. An instruction to the program processing the file, and not an instruction to be compiled.
    – Jamie Hale
    Apr 4, 2018 at 12:52

It gives the solidity compiler a hint on how to process the code. E.g. if it should allow new features. For more general information on the usage of pragma in programming you might want to read this: https://en.wikipedia.org/wiki/Directive_(programming)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.