Dean,
>Do most developers define all the variables at the beginning of a routine, or declare them local as they are defined?
I (this topic is mostly an issue of personal preference) declare memvars at their particular scope. Probably 99% of the time it is LOCAL, the 0.999% that are PRIVATE come with a specific comment as to why it is being declared private instead of local. PUBLIC is rarely ever used and again get specifically commented.
Routine-wide memvars get declared at the top of the routine, localized scopes at point of use:
function XYZ( pcArg )
if ( isnull( pcArg ) )
return ""
endif
local lcStr ...
... more code
local i
i = at( ' ', lcStr )
if ( i > 0 )
local j
...
endif