Smart Contract Programming Language
Solidity is a high-level programming language used to write smart contracts on Ethereum blockchain.
Contract-based language Statically typed Runs on Ethereum Virtual Machine (EVM)
pragma solidity ^0.8.0;
contract MyContract {
uint value;
}
uint → positive numbers int → integers bool → true/false string → text address → wallet address
function setValue(uint _value) public {
value = _value;
}
pragma solidity ^0.8.0;
contract Storage {
uint data;
function set(uint _data) public {
data = _data;
}
function get() public view returns (uint) {
return data;
}
}
public → accessible private → restricted view → read-only pure → no state change