I got this

Zombie storage myZombie = zombies[_zombieId];

Zombie is a struct:

Struct Zombie {
String name;
Uint dna;
}

zombies is an array of Zombie

Zombie[ ] public zombies;

_zombieId is a parameter, a uint

I passed in _zombieId to the array right?
Which gets stored in the myZombie variable which is a struct

What did I then store?
An array or a struct

Jun 2, 2022, 10:26 AM
No, you pass Zombie to the array _zombieId is an id of the zombi object and at the same time _zombieId is an index of this zombie in array
Jun 2, 2022, 10:36 AM
You've managed to confuse me even further 😂
Let me see if I can break it down and reiterate back to you
Sorry, I think I have really lost it
Care to expand the question with your own terms and examples?
Jun 2, 2022, 10:42 AM
Do you now about array? How it works? What is the index in array?
how are elements stored in an array?
Jun 2, 2022, 10:46 AM
Yes. I understand arrays fr JavaScript and C
Index positions too and how they are stored. Yeah
I just checked a previous code and I saw the understanding 😂
Thanks a lot man 😊
Jun 2, 2022, 10:53 AM

© 2024 Draquery.com All rights reserved.