9

Zero values, as in what would placehold the value when a key in a mapping is not yet assigned.

13

In Solidity docs they are called initial values:

  • Value Types

    • boolean: false
    • string: ""
    • int: 0
    • uint: 0
    • fixed: 0.0 (presumably; this type is not fully supported)
    • enum: the first element of the enum
    • address: 0x0
    • function
      • internal: empty function, returning initial values (if return is needed)
      • external: function that throws when called
  • Reference Types

    • mapping: empty mapping
    • struct: a struct where all members are set to initial values
    • array
      • dynamically-sized: []
      • fixed-sized: an array of the fixed size where all elements are set to initial values

When you use the delete keyword it will assign the initial value to the variable, except for mappings, where it doesn't have any effect. For structs the delete keyword will recurse into the members, unless they are mappings.

  • How do I check if in mapping(uint8 -> address) testMap the address is still initial value? Is this correct: testMap[0] == address(0)? – Jagrut Feb 25 '19 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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