Unit level variable declaration
I have a quick question on variable declaration that I haven't been able to find an answer on.
For a VBScript example, in a Unit, we would put a declaration in a Subroutine such "Dim objectX".
I see that Test Complete allows me to put this declaration outside of any subroutine/function in a Unit and also set it. This seems to allow this declaration (i.e. "objectX") to be used for every subroutine/function within the Unit (like a global unit variable) instead of setting it in each subroutine/function.
My question is if this is acceptable to do? Can variables be declared outside of subroutines/functions at the Unit level? It appears to work but, maybe it isn't suggested? Are there any drawbacks or 'gotchas' if it is allowed?
There are a couple of sections regarding variables and their scope in here: