0

I created mapping address-> uint and i need to make whole mapping -> uints values set to 0 is it possible?

1 Answer 1

1

i need to make whole mapping -> uints values set to 0

If you're talking about immediately after creation, they already are.

https://docs.soliditylang.org/en/v0.8.0/types.html?highlight=types#mapping-types

"You can think of mappings as hash tables, which are virtually initialised such that every possible key exists and is mapped to a value whose byte-representation is all zeros, a type’s default value."

If you're talking about later on, after the mapping has been used, then you'll need a way to record which addresses have had non-zero values set.

See Clearing Mappings in the official docs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.