Hello everyone, I recently came across the for i, v in next variant of the for loop and was wondering if its only use was to loop through a list? After experimenting, I found it worked similarly, if not the same as for i, v in pairs? If not, what can it be used for that pairs cannot?
local example = {"apple", "banana" ,"carrot", "burger"}
for i, v in next, example do
print(v)
end
Output from pairs;
apple, banana, carrot, burger
Output from next;
apple, banana, carrot, burger

1 comment
Alright, thanks for clarifying!