Search code examples
blockchainethereumsolidity

Why is no callable?


Practicing with Solidity in version 0.5.0. I am Beginner.

I have seen that it is a common issue diving through the net but I have not found the reason, and the strangest thing is that I have seen people that the same code does not give the error and others do. Nothing has been clear to me.

pragma solidity ^0.5.0;

contract Variables {

string public one = "One";
int public two = -2;
uint public tree = 3;
address public myaddress = msg.sender;

mapping(address => estructura) map;

struct estructura {
uint four;
uint five;
}

function setestructura(uint a, uint b) public {
map(myaddress).four = a;
map(myaddress).five = b;
}



}   

The errors in the function are: Type is not callabe and TypeError: member "four" is missing or not visible after argument-dependent search in tuple ()


Solution

  • you can fix it by replacing

    map(myaddress).four = a;
    map(myaddress).five = b;
    

    to

    map[myaddress].four = a;
    map[myaddress].five = b;