TT’s generic programming guidelines
Declare your local variables close to where they’re used
Do not declare all your variables at the top. Instead, declare them where you use them first. That makes it easier to see their type and also leads to better locality, avoiding accidental use of stale (old) values.
var i as integer
var item as FileReference
var files() as FileReference
Source: Thomas Tempelmann