In solidity what do numbers initiate to assuming we just call a plain number.
uint256 plainNumber
I understand it's zero. But what I'm asking for, is there a way to detect if that number has been set by the compiler or a user variable. For example...
uint256 plainNumber;
***some code and we continue***
plainNumber = 0;
Is there any way to detect if I set the plainNumber or if it was simply initialized at zero? Any special protocol?
From my experience, you cannot know if the value is 0 because it's the inital state or if it is 0 because of 'you'.
One 'solution' would be to use a struct of this kind, and set the isSet
bool when you change the plainNumber value :
struct myPlainNumber {
uint256 plainNumber
bool isSet
}