Advanced Debugging (shoveling into nested arrays)

I know I’m not going to explain this right…

Just looking for some clarification on why the shovel operator would shovel an element into every array. It was occurring in the dups method, and shoveling the current index into the value array for every key, and then was occurring down in the transpose method with the nested arrays.

Seems like using + [index] or += [el], respectively (instead of << index and << el) fixed the issue. Just wondering if I could get some clarification on why that would be the case

Hi Brett,

Check out Erika’s comment on pass by reference issue and why the element is going into every array. Question on Advanced Debugging Problem Set.

Michael

1 Like