Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is the purpose of this in for loops?

I've seen this being used many times, but never really understood it.

Why is it that some people write their for loops like this:

for _,v in pairs(table) do
	--code here
end

Instead of this?

for i,v in pairs(table) do
	--code here
end

If you didn't see the difference, it's that instead of an "i" (or some other argument) being there, they put a "_". Is this just a name for the argument? Just a style some people do? Or does it actually do something?

1 answer

✓ Accepted answer

This already has some very good answers.

For a quick answer, they are the same. Simply variable names.

Read here and here for more information.

1 comment

0

Alright, thank you for the clarification.

This discussion is preserved as it was. New answers, comments, and votes are closed.