0

Hello everyone i have a code like:

mapping(address => uint)owner;

function show() view public returns(uint) {
    return owner[msg.sender];
    //return msg.sender.balance;
}

in slodity and when i return owner[msg.sender] it shows me '0: uint256: 0' and when i return msg.sender.balance it shows me '0: uint256: 99999999999996134991' i want to know what's the difference and what do they mean ? Tnx for your help .

  • The first one is the amount of tokens owned by msg.sender, and the second one is the amount of Ether owned by msg.sender. – goodvibration Sep 16 '18 at 7:31
  • @goodvibration TnQ so much ... – developeroka Sep 16 '18 at 9:42
3
  • owner[msg.sender] will give you the uint value from the owner map given the address key. Since you have not set any value, the map will return the default values which is 0 for the uint (alias to uint256) type.

  • msg.sender.balance returns the ETH balance in wei denomination of the sender account

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.