Thanks, I see it much much clearer now.
So a function has its own scope, and if I use any variable it will be treated as a new variable even if there is already the same variable outside of it.
-edit-
I just realized that I was wrong.
A function has a LOCAL scope so if I make a variable even if it is the same name as the variable outside of the function, it will be treated as local, but if I want to use the one that's on the global I have to tell it inside the function. It's not declaring a new one, but using the outside one.
It's quite confusing I prefer if there's already existing variable then it will use that because I hardly use variable name that already exists
So a function has its own scope, and if I use any variable it will be treated as a new variable even if there is already the same variable outside of it.
-edit-
I just realized that I was wrong.
A function has a LOCAL scope so if I make a variable even if it is the same name as the variable outside of the function, it will be treated as local, but if I want to use the one that's on the global I have to tell it inside the function. It's not declaring a new one, but using the outside one.
It's quite confusing I prefer if there's already existing variable then it will use that because I hardly use variable name that already exists