Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone answer my question that i have been wondering in a long time?

Asked by 6 years ago

Hello.

I want to know what's the different between:

for _,event in pairs() do

and

for i,v in pairs() do

Can someone please tell me what's the different is?

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

The i and v are just variable names. You can name them anything you want, although the most common naming is i and v which stand for index and value.

However if you i.e. don't need to use the index variable, you can name it _. It will prevent it from being declared as a variable, and trying to use _ as a normal variable will result in an error.

Ad

Answer this question