I have a mapping in my smart contract with bytes32
keys and bytes
values. How can I check if bytes
value exists for specific key?
Mapping is something like this:
mapping(bytes32 => bytes) public Countries;
bytessolidity
I have a mapping in my smart contract with bytes32
keys and bytes
values. How can I check if bytes
value exists for specific key?
Mapping is something like this:
mapping(bytes32 => bytes) public Countries;
Best Answer
You can check it via
.length
. It will be 0 if it is empty/uninitialised.