#question about for loop

1 messages · Page 1 of 1 (latest)

tame jolt
#

what's the difference between
for _, v in table do
and
for i, v in table do
other then counting how many times it looped over, is there any other difference like a difference in performance or other uses that for _, v in table haves?

indigo condor
#

i think there's no performance difference

tame jolt
#

oh

tame jolt
#

anyway thanks

errant osprey
oak fog
#

so just cleaner code and be able to use i for something else

oak fog
errant osprey
#

_ is parsed as a useless variable, using it in the for will tell roblox not to asigne the value, it remove like one instruction

mellow vortex
#

not sure why the formatting is all fucked up now

robust cipher
#

i literally never use _ i always use i out of habit even if i dont need it

errant osprey
frank whale
#

Barely

#

Ye it removes an instruction but it doesn’t do that much in terms of understanding

errant osprey
frank whale
#

Elaborate

errant osprey
#

when you see _ you know it will never be used, when you see i you need to check if its used

#

its why conventions are existing

frank whale
#

That’s not readability

errant osprey
frank whale
#

It’s a good indicator tho

errant osprey
#

Indicators are for readability ^^ like types for exemple

frank whale
errant osprey
#

it remind your self what is what, it help a lot

frank whale
#

why tf