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

I forgot what the "i", and "v", represent, and what does in pairs do?

Asked by 10 years ago

How do you use "in pairs", and what are the definitions of i, and v?

1 answer

Log in to vote
-1
Answered by 10 years ago

I and v are just variables. You could use any letter to sub those. I is the index and the value of i increases by 1 every time it does the loop while v is the item or value of what you are requesting like if its a table it and i is worth 3 then v will be the third item in your table. In LITERALLY means in. Like in a box, lol. Pairs just gets the key and its value (i and v).

Example:

for num,val in pairs (game.Workspace:GetChildren()) do
    print(num,val)
    wait()
end
Ad

Answer this question