mirror of
https://github.com/autistic-symposium/blockchains-security-toolkit.git
synced 2025-05-02 06:46:12 -04:00
Update README.md
This commit is contained in:
parent
ec2bf17b8e
commit
0bcfa9322b
1 changed files with 10 additions and 0 deletions
|
@ -33,6 +33,16 @@ uint8 numberTwo;
|
|||
uint256 bigNumber;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Constant vs. Immutable variables
|
||||
|
||||
Constant values can sometimes be cheaper than immutable values:
|
||||
|
||||
1. For a constant variable, the expression assigned to it is copied to all the places where it is accessed and also re-evaluated each time, allowing local optimizations.
|
||||
2. Immutable variables are evaluated once at construction time and their value is copied to all the places in the code where they are accessed. For these values, 32 bytes are reserved, even if they would fit in fewer bytes.
|
||||
|
||||
|
||||
---
|
||||
|
||||
### Mappings are cheaper than Arrays
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue