August 06, 2008
Copy- (or Cut)-and-paste as much as possible; avoid re-typing code!
LOCAL lnTotalInvoice && Type only one (1) of the instances of 'lnTotalInvoice'
lnTotalInvoice = … && and then copy-and-paste it for all other instances
This helps prevent inadvertent typos (are there any other kind?!) from creeping into your code.
It is also helpful when you communicate with other developers (e.g., via e-mail when posting to an on-line news group or message board) so that you don’t accidentally modify the code in question (again introducing that inadvertent typo <g>).
Doug Carpenter reminded me of a trick when working with memory variables that have been declared LOCAL and PUBLIC (but not PRIVATE):
typing ZLOC followed by the <Spacebar> in a .Prg file/method causes VFP to display an IntelliSense list of available LOCAL and PUBLIC memvars and parameters.
Here is an example of the list that displays after you press the <Spacebar>:
Posted by abergquist on August 6, 2008 | Permalink
TrackBack URL for this entry:
Listed below are links to weblogs that reference Copy- (or Cut)-and-paste as much as possible; avoid re-typing code! :
Good for people to know.
Posted by: Melanie | Oct 28, 2008 9:45:21 PM