Solidity Strange Skills (1)
IPFS
Today I will talk about how Array can not specify the length.
Anyone who has written it knows that in Solidity, if you want to define a variable as Array, you need to specify whether it is memory or storage.
If it is memory, the length must be specified when the variable is first created.
For example, if your Array is directly created by inserting a certain value, the Array cannot be increased in length, that is, it cannot be pushed.
It's really troublesome
But I found that the Array in the mapping does not need to define the length
mapping(uint256=>address[]) _need;
In this way, you can have an Array of free length.
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!
- Author
- More