Hello. Again. It’s been a while. But I just wanted to know that this symbol means: “, or ,”. I’ve seen it a lot and absolutely NOTHING has any tutorials on it. What does it mean? What does it do?
or
? If not, where did you see it?
It can be used as a temp variable name, often where it doesn’t matter, as an indication it can be ignored, eg in the example below, when you loop using pairs, there are two variables provided for each item. If we only want to use the second one, we can use _ to show the first one is unused
for _,b in pairs(balls) do -- loop through balls table
b.x=b.x+1
end
Thankyou! So where the _ is, was that a variable but doesn’t need to be used? So you put
for _,b in pairs(balls) do -- The _ was a variable, but doesn't need to be used
b.x=b.x+1
end
That’s right. It’s not something you need to do, it’s mainly used by experienced programmers
Try it for yourself!