I have a function where I pass a id. With that id the contract find in a mapping a struct. My idea is to check if exists that struct with the given id with a if clause.
I try with 0, null, "".
Is that possible? Thx
I have a function where I pass a id. With that id the contract find in a mapping a struct. My idea is to check if exists that struct with the given id with a if clause.
I try with 0, null, "".
Is that possible? Thx
bool validfield to your struct, set it totruewhenever you add a struct to the mapping, and use it in order to check whether or not the struct is valid (i.e., whether or not it "exists"). – goodvibration Jan 17 '19 at 12:04deletekeyword, zeros all struct values. You can check not expected any key stored as 0 value. You know, when add new key to your struct, it increase gas fee. – Fatih Mert Doğancan Mar 22 '22 at 22:05