I want to use a mapping that stores prices for each token in my ERC721 contract but am hitting an issue with the default uint value being 0. I'd like for my getPrice(uint256 tokenId)
function to account for both a zero value price and an empty value if possible. I'm wondering if there are any patterns in practice that solve this issue.
mapping (uint256 => uint256) listing;
function getPrice(uint256 tokenId) {
// will return 0 for no value found, which could lead to the perception that the price is 0.
return listing[tokenId];
}