pragma solidity >=0.4.0 <0.7.0;
contract NewHello{
mapping(address => string) public users; // contains a name for every address
function updateUser(string memory name) public {
if(string name != users[name]){
users[msg.sender] = name; // set name for address
}
}
function getUser(address userAddress) public view returns(string memory) {
return users[userAddress]; // return address name
}
}
well I have 2 func fist one set the name second one get the name.
my goal is : I wanna check the users . if user isn't registered , register this user than return the user name use the getUser function.
when I compile my contract I give a error like this: Expected ')' but got identifier if(string name != users[name]){ ^--^
my getUser func. works very well. I can get results which I want but I can't fixed the userUpdate func.
what should I do ? anyone can help me please :)