I get the following error

type address is not implicitly convertible to expected type address payable on the withdraw function.

pragma solidity ^0.8.1;

contract sendMoneyExamples{
    uint public getRecivedMoney;
    function reciveMoney()public payable{
    function getBalance()view public returns(uint){
        return address(this).balance;
    function withdraw()public {
        address payable to = msg.sender;
    function withdrawato(address payable _to)public{

1 Answer 1


The type of the 'to' variable is address payable whereas the type of msg.sender is address. You can't implicitly convert an address to address payable as the error states. Remove the payable keyword from the to variable and it will be fine.

  • Thanks a lot..... Jun 24, 2021 at 9:30

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.