-
Notifications
You must be signed in to change notification settings - Fork 553
Open
Description
Summary
- Rename
countertoresultIndex. - Rename
itozombieIndex.
This will make understanding easier for everyone, especially beginners to programming and the concepts.
This is from my experience, going through the cryptozombies curriculum the second time to revise all the concepts.
Original:
...
- Declare a
uintcalledcounterand set it equal to0. We'll use this variable to keep track of the index in ourresultarray. - Declare a
forloop that starts fromuint i = 0and goes up throughi < zombies.length. This will iterate over every zombie in our array. - Inside the
forloop, make anifstatement that checks ifzombieToOwner[i]is equal to_owner. This will compare the two addresses to see if we have a match. - Inside the
ifstatement:- Add the zombie's ID to our
resultarray by settingresult[counter]equal toi. - Increment
counterby 1 (see theforloop example above).
- Add the zombie's ID to our
Suggested
...
- Declare a
uintcalledresultIndexand set it equal to0. We'll use this variable to keep track of the index in ourresultarray. - Declare a
forloop that starts fromuint zombieIndex = 0and goes up throughzombieIndex < zombies.length. We will use this variable to iterate over every zombie in our array. - Inside the
forloop, make anifstatement that checks ifzombieToOwner[zombieIndex]is equal to_owner. This will compare the two addresses to see if we have a match. - Inside the
ifstatement:- Add the zombie's ID to our
resultarray by settingresult[resultIndex]equal tozombieIndex. - Increment
resultIndexby 1 (see theforloop example above).
- Add the zombie's ID to our
Action
- Would like to know your thoughts and feedback.
- I can be the one making the changes and submitting the pull request.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels