Always been cautious not to use the same name twice… but for local variables, it seems better to always just use something like “item” or “x”… is it okay to do that? Will variable names affect page-load time or anything like that?
Stick with this caution, helps to avoid problems
@codo Local variables are lexically scoped, so it’s perfectly reasonable to have local variables reuse names. In that case, the setter/getter blocks reference to the closest variable with that name in the stack. You can also have local variables with the same name as globals, which are differentiated with the “global” keyword. There shouldn’t be any performance impact one way or the other.
2 Likes
Thank you so much! This was very well explained.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.