Yes, bool senior is un the struct and function getPerson
contract HelloWorld{
//struct can consist of string, integer(uint), address
//defines structure of this person with these properties
struct Person{
string name;
uint age;
uint height;
bool senior;
}
// address walletAddress;
//mapping address
mapping(address => Person) private people;
function createPerson(string memory name, uint age, uint height) public{
Person memory newPerson;
newPerson.name = name;
newPerson.age = age;
newPerson.height = height;
//how to assign a newPerson in the mapping
//when input address will get back newPerson
if(age >= 65){
newPerson.senior = true;
}
else{
newPerson.senior = false;
}
insertPerson(newPerson);
}
//internal private
function insertPerson(Person memory newPerson) private{
address creator = msg.sender;
people[creator] = newPerson;
}
function getPerson() public view returns(string memory name, uint age, uint height, bool senior){
address creator = msg.sender;
return (people[creator].name, people[creator].age, people[creator].height, people[creator].senior);
}
}