Skip to content
Discussion options

You must be logged in to vote

Hello @pharmacyhacks

   struct People {
        uint256 favoriteNumber;
        string name;
    }

 function addPerson(string memory _name, uint256 _favoriteNumber) public {
        people.push(People(_favoriteNumber, _name));
        nameToFavoriteNumber[_name] = _favoriteNumber;
    }

I'm pretty much sure you are referring to this code, and the answer is the following.

Using under score on functions or variables means nothing to he compiler itself but is a convention for good practices at coding, the underscore means that function/variable can only be called from itself, in other words _name exists just on the context of the function and can be called just on that specific function.

I …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cromewar
Comment options

You must be logged in to vote
2 replies
@cromewar
Comment options

@pharmacistcodes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants