I have a simple mapping:
mapping(address => string) professorsExam;
How can I check if msg.sender
is a key in this mapping, and if it is, get its value? If it isn't I should return something.
string memory professorsExamHash = professorsExam[msg.sender]; // The hash of the exam owned by msg.sender
if(professorsExamHash == 0x0){
return "No exam hash asociated with this professor address";
}
This doesn't work,
TypeError: Operator == not compatible with types string memory and int_const 0
I have tried many other things. But ==
isn't compatible between anything so far.