What is Solidity?
Solidarity is used to design/program smart contracts. What is smart contract ? Please refer my post “What is smart contract-https://immtalimm.blogspot.com/2023/08/what-is-smart-contracts.html”.
Smart Contract is an Object Oriented Programming towards solving program with smart contract logic. Some of the take-aways from Solidity:
1. Solidity is used to program smart contracts with the smart logic, in line with the generation of chain of transactions as in Blockchain.
2. Solidity can be programmed and complied on EVM ( Ethereum Virtual Machine).
3. As one of the OOPs program, it is similar to C and C++. The ‘main’ definition in C is equivalent to ‘contract’ in Solidity.
4. Like any languages, Solidity has also variables, functions, classes, arithmetic operations, string manipulation and other concepts.
5. EVM provides a runtime environment for the smart contracts.
6. EVM is specialized in preventing DoS attacks.
Data Types in Solidity
- It supports all the common data types seen in other OOP languages, such as,Boolean- The Boolean data types returns ‘1’ when the condition is true and ‘0’ when it is false, depending on the status of the condition.
- Integer- You can sign or unsigned integer values in Solidity. It also supports runtime exceptions and the ‘uint8’ and ‘uint256’ keywords.
- String-Single or double quotes can denote a string.
- Modifier- Before executing the code for a smart contract, a modifier often verifies that any condition is rational.
- Array- The syntax of Solidity programming is like the top other OOP languages, and it supports both single and multidimensional arrays.
What is Pragma ( in Solidity)
Definition in the program.
>=0.4.16<0.7.0;b This usually defines the version of solidity compiler.
- Pragmas are directives to the compiler about how to handle the code. Every line of Solidity source code should begin with a”version pragma”, which specifies which version of the solidity compiler to use.
- This prevents the code from being incompatible with future computer versions that may introduce changes.
Will review your comment and get back!