How do i use i,v in pairs() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i use i,v in pairs()

Help

8th Feb 2020, 1:54 PM
joash
joash - avatar
2 Answers
0
On each iteration, the for loop calls its iterator function with two arguments. See this example : a = {"one","two","three"} for i, v in ipairs(a) do print(i, v) end
11th Feb 2020, 5:55 PM
Siavash Damari
Siavash Damari - avatar
0
A = { "This" = "that", "That" = "this" } For I, v in pairs(A) --code here End Its generally used for dictionaries. I is the key/index of it, so in this case the first item's key is "this" and the second's is "that". V is value.
10th May 2021, 2:11 PM
Noah
Noah - avatar