36 - Types
Solidity has two categories of types: Value Types and Reference Types.
-
Value Types are called so because variables of these types will always be passed by value, i.e. they are always copied when they are used as function arguments or in assignments.
-
In contrast, Reference Types can be modified through multiple different names i.e. references to the same underlying variable.
- Value & Reference
- Value: Passed by Value
- Copied: Arguments/Assignments
- Reference: Passed by Reference
- Multiple Names -> Same Variable
- Security: State Updates/Transitions