67 - delete
-
delete a
assigns the initial value for the type toa
-
For integers it is equivalent to
a = 0
-
For arrays, it assigns a dynamic array of length zero or a static array of the same length with all elements set to their initial value
-
delete a[x]
deletes the item atindex x
of the array and leaves all other elements and the length of the array untouched -
For structs, it assigns a struct with all members reset
-
delete
has no effect on mappings. So if you delete a struct, it will reset all members that are not mappings and also recurse into the members unless they are mappings. -
For mappings, individual keys and what they map to can be deleted: If a is a mapping, then delete
a[x]
will delete the value stored at x
delete a
-> Assigns Initial Value toa
- Ints ->
0
- Dynamic Arrays -> Length
0
- Static Arrays -> Same Length, Initial Value Elements
Arr[x]
-> Deletes Item @x
- Structs -> Members Reset Unless Mappings
- Mappings -> No Effect
- Specific Key -> Values @ Key Deleted
- Ints ->