Understanding Solidity and Solidity files
Solidity is a programming language that has similarities with JavaScript. Solidity is a statically-typed Object-Oriented Programming (OOP) language. Solidity is case-sensitive, and variables should use the same case during its definition and usage. The statement terminator in Solidity is the semicolon – ;
.
Solidity code is written in Solidity files that have the .sol
extension. They are human-readable text files that can be opened as text files in any editor, including Notepad.
A Solidity file is composed of the following four high-level constructs:
- Pragma
- Comments
- Import
- Contract/library/interface
Let's have a look at each in brief.
Pragma
Pragma is generally the first line of code within any Solidity file. It is a directive that specifies the target compiler version to be used for compiling the current Solidity file. Solidity is a new language and is subject to continuous improvement on...