Thanks for the reply,
I am wondering which is the most efficient use of memory. Is it better to declare once and use it reguarly or keep declaring the variable each time the subroutine is entered?
Cheers
This probably dependent on the memory model your programming language uses.
For Java and B4A, I think there is regular garbage collection. Unused variables/objects will be deallocated. So if you call your sub infrequently, the memory allocated will be lesser. If you call it alot then those variables will re-allocated memory and de-allocate memory (when garbage collection is done).
I would however declare variables based on their scope rather than worrying about the underlying implementations.
EDIT: Again! agraham beat me to it.