nameToFavoriteNumber Explanation #705
Answered
by
cromewar
maxdporter
asked this question in
Q&A
-
In the very last line of the SimpleStorage.sol file, there's this line of code: "nameToFavoriteNumber[_name] = _favoriteNumber;" can someone explain how what this line means and how it works? |
Beta Was this translation helpful? Give feedback.
Answered by
cromewar
Jan 6, 2022
Replies: 1 comment 1 reply
-
Hello @maxdporter |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cromewar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @maxdporter
nameToFavoriteNumber is a mapping which links to type of data (string and unit) so you are assigning it using the
_name
as the index and the_favoriteNumber
as input. Look at this: https://medium.com/upstate-interactive/mappings-in-solidity-explained-in-under-two-minutes-ecba88aff96e i would help you a lot to understand how it works.