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

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

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

1 answer

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

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