Replies: 1 comment
-
The first function is just easier to understand especially when working with more complex structs with many fields. In the first function, the newPerson variable is being created using the syntax In the second function, the newPerson variable is being created using the syntax |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all
i have a simple question, what's the difference between this two 'newPerson' variable if they have the same exact output ?
1:
function addPerson(string memory _name, uint256 _favoriteNumber) public {
People memory newPerson = People({favoriteNumber: _favoriteNumber, name: _name});
people.push(newPerson);
}
2:
function addPerson(string memory _name, uint256 _favoriteNumber) public {
People memory newPerson = People(_favoriteNumber, _name);
people.push(newPerson);
}
Beta Was this translation helpful? Give feedback.
All reactions