Probably a super simple question. But on slide 18 on the Unit 5 slideshow, I am not getting the answer shown on the slide. My issue is with Line 2 of the program. Can someone explain how they got that answer? TIA.
Thank you for your quick response. But I was actually confused with the next line of the program (02). My questions wasn’t clear - when I said line 2 I didn’t mean the 2nd line I meant 02 which is the 3rd line of the program. myStuff[myStuff] = myStuff;
If you could clarify that one, I would realy appreciate it!
Okay, that one bends the mind a bit.
myStuff to be “dog”. Then we look for where to assign it.
We look to evaluate
myStuff[myStuff] we see [ ] so we need to evaluate
myStuff. Because there are more [ ] we evaluate the
2 inside them. Well, that is just 2. So now we can resolve
myStuff to be 3 from the array. Having that we now have
myStuff which currently holds the value 10.
So we assign the value “dog” to the location
myStuff, the end of the list.