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. Commented Sep 16, 2018 at 7:31
  • @goodvibration TnQ so much ... Commented Sep 16, 2018 at 9:42

1 Answer 1

  • 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

  • Tnx for your help Commented Sep 16, 2018 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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