Re: scope of variables
- Posted by petelomax Dec 31, 2010
- 2646 views
FWIW, I'm against all this willy-nilly declaration of variables anywhere; if you feel the need to declare more variables half way down a routine it is probably a sign that your routine is getting too big. That aside, I just thought of this idiom:
procedure P(...,boolean preserve) if preserve then object wasX = X end if ... if preserve then X = wasX end if end procedure
While I don't much care whether that is right, wrong, or whatever, someone here might want to consider it.
Regards,
Pete