Solidity Programming Language – Mapping
In Solidity, mapping is a data structure used to store key-value pairs, somewhat similar to dictionaries or hash maps in other programming languages.
Mappings can be used with various data types as keys and values, including other mappings or custom data structures. It’s important to note that mappings in Solidity are not iterable, meaning you cannot directly loop through all the keys or values in a mapping. If you need to iterate over the keys or values, you might need to maintain an additional data structure like an array or use a different approach depending on your specific use case.
- Concept of keys and values.
- Mapping (key=> value).
Code:
Now the code for advance mapping
Here we are trying to add older donation + new donation so finally we get the updated amount.