It depends on the scope of the variable.
A variable may be used only by :
- a few lines of code (a "for loop" use a local variable with implicit declaration)
- a function
- a class
You can also define a global variable with the singleton (AutoLoad) technic in Godot.
As a variable consumes memory, it is better for efficiency and performance to choose the right scope for each variable.
This advice is general regardless of the programming language you use.
Today we have computers with a large memory, but when I started to learn programming, it was not.