Can someone help me with a nested struct, I am unable to map the nested struct. I need to get into a struct some user details like name, gender, etc., and the user's home address as well, I tried the following but did not get anywhere:
struct Pdetails {
string fName;
string lName
int256 age;
enum gender;
}
struct Addr{
string line 1;
string line 2;
string city;
string state;
int256 pincode;
}
function createUser(address _userAddress, uint256 _userId, string _fName, string _lName, int256 _age, enum _gender, string _line1, string _line2, string _city, string _state, int256 _pincode ) public {
User storage user = users[_userAddress];
require(!user.set);
//Store the user
users[_userAddress] = User(
{
id: _userId,
first_name: _fName,
last_name: _lName,
age: _age,
gender : _gender,
Addr line1: _line1,
Addr line2: _line2,
city: _city,
state: _state,
pincode: _pincode
set: true
}
);
}
i tried to map these but i dont think this is the right way to do it