Key, Value vs Item, Index

I’ve been looking at both codes and noticed that splat reverses the intuitive “index then item”
why is it this way?

Sorry I’m not sure I follow what you mean by:

splat reverses the intuitive “index then item”

I find it odd that splat forces me to “for value, index in collection” while tuple/hash needs “for key, value in tuple/hash”

Ooops!, here’s the correct link for to compare macros 3 vs 4 with

I’m still not sure what you mean by splat in this context, but I think I see what you’re talking about now. I’m pretty sure the gist of it is the macro for loop arguments are setup the same as the non-macro context. E.g. with a normal array and #each_with_index it’s value, index. Whereas with a normal hash/named tuple and #each it’s key, value.


Thanks, all better.