|Think about Loose Coupling|
Re^2: The error says the value is uninitialized, but it works anywayby mizducky (Novice)
|on Aug 18, 2019 at 00:14 UTC||Need Help??|
I want to thank all of you for your help in understanding this problem. I went to bed thinking about it and I realized the point about how the removal of the element "pink" changes the first array, and how that impacts the rest of the code.
As a student I don't mind if I lose a few points for it not being exactly right, I will still turn in my first script even though I've learned more from you guys. It's my work and I'm ok with taking the grade I've earned.
So I didn't know that "printf debugging" was a term, but I had already tried that a few times. In the end I had just determined to keep the script as simple as possible as long as it did the thing.
Here is what I had done to see what was happening.
Of course this left me with a lot of questions originally. Here is what prints for me.
I understand now, that the element "purple" is never evaluated, its skipped when "pink" is removed and the element numbers change. Then the next element "brown" is removed and then there are basically 2 empty spaces that the loop is trying to evaluate.
My classmate made two new arrays and set the loop to move the word to another array, shifting from the @colors and pushing to @new (basically).
For each of you who responded, thank you so much for your help. I will keep using all the resources you have sent so that I can do better in the future.