Quick question (for i,v in pairs and for _,v in pairs)

whats the difference between:

for _,v in pairs

and

for i,v in pairs

Just a different variable name, they are the same

1 Like

_ is a blank global, you cannot use it

None, in the former example the index isn’t needed so the dummy variable _ is used. In the latter, it is being used so a more meaningful identifier is used.

(you should really search before posting too)

Basically there is no differences, “_” is normally used when the variable is not going to be used.

It can be used. The _ has no special meaning syntax-wise. It is still a valid identifier. Although the point of that is to not

4 Likes

When I attempt to print it in code, it will error

Then that was an issue with your code, because this is fine

1 Like

Oh wait, my bad, it actually screams at me that this is a placeholder

Yes that is the Luau linter

I know, I just forgot if it errored or warned

You didn’t just assign a value to an empty global… GUARDS! Get him!