I want to check whether a uint256 variable is null. How can I do so in solidity?

  • 2
    You can check it by comparing with 0
    – Aniket
    Nov 21, 2018 at 8:09

1 Answer 1


There aren't any things like null in solidity.

All the uninitialized variables are set to a zero like value.

Have a look at this answer for more examples.

  • 1
    Indeed, but I'd add that integers do not normally have nulls in any programming language. They are primitives. Nov 21, 2018 at 23:10

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.