.png)
Error/Exception handling in solidity
"Within the Solidity programming language, error handling emerges as a robust mechanism, offering the capability to deftly address runtime errors. This proficiency is instrumental in upholding the seamless progression of program execution, ensuring that even in the face of unexpected issues, the code can gracefully continue its normal operation."
.png)
Function Modifiers - view and pure
- Functions marked as "view" are read-only functions that do not modify the state of the contract.
- They can only read data from the blockchain and return values.
- These functions are free to call and do not consume any gas when invoked by external actors.
- View functions are primarily used for querying and fetching data from the blockchain.
" Example : "
Imagine a voting contract where users can check the number of votes cast for a particular candidate. In this case, you can use a "view" function to retrieve this information without altering the contract's state.
.png)
Mappings/Dictionaries in solidity
Mappings are similar to hashes or dictionaries in other programming languages, where each key maps to a value. One key difference with mappings in Solidity is that you don't have to predefine all the keys, as you do with an array. Instead, you can add and remove keys dynamically. Mappings are often used to store data that can be looked up by a unique identifier, such as an address or an ID.
.png)
Function visibility / Access modifiers in solidity
In Solidity, function visibility or access modifiers are keywords used to control who can call a specific function within a smart contract. These access modifiers play a crucial role in defining the security and functionality of smart contracts. There are four primary access modifiers in Solidity:
public Function: Functions declared as public can be called from anywhere, including within the contract, from other contracts, and externally (by anyone). This is the default visibility for functions in Solidity......