How do I check If a map entry doesn't exist for a given sender?

by Tiago Bértolo   Last Updated August 13, 2019 20:28 PM - source

I have a map such as:

mapping (address => bytes32) private myMap;

Later in the code, in a function, I want to ensure my sender already has an entry in that given map.

Can I do this?

require(!myMap[msg.sender], 'there is an entry in the map already!')


Related Questions



Unit testing for assert()/require() in Truffle/Solidity

Updated December 01, 2017 04:28 AM

Why not use require() in place of assert()?

Updated May 22, 2018 20:28 PM

Is there a way to know the REAL msg.sender?

Updated December 20, 2018 08:28 AM