Michael,
Most definitely YES.
The only valid reason to not do so would be if you could declare the
variable explicitly in its declaration like we used to in Clipper
i.e
Local llOK=.F.
I have seen (and used) the equivalent VFP Below, but personally I now always
use the assignment in the block where it belongs.
LPARAMETERS tcSomeValue
LOCAL llOK as Logical, lnID as Integer
lnID = this.oBiz.GetKey(tcSomeValue)
llOK = .F. && Set Default value
IF lnID > 0 THEN
llOK = .T.
ELSE
WITH this.oBiz
MESSAGEBOX(.cErrMsg,.nErrBtns,.cErrTitle) && echo problems encountered
by BizObj
ENDWITH && this.oBiz
ENDIF
Dave Crozier
"A computer is a stupid machine with the ability to do incredibly smart
things, while computer programmers are smart people with the ability to do
incredibly stupid things. They are, in short, a perfect match" - Bill
Bryson
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of MB Software Solutions
Sent: 14 June 2006 13:53
To: Profox
Subject: Style question on default values in variables
The line below in the ELSE block specifically sets the llOK variable to .F.
However, that variable is .F. by default. Would you include that line
anyway? I know, it's trivial, but I was just curious about what assumptions
other developers make. (Personally, I try to make no assumptions but in
this case, it shouldn't matter at all.)
LPARAMETERS tcSomeValue
LOCAL llOK as Logical, lnID as Integer
lnID = this.oBiz.GetKey(tcSomeValue)
IF lnID > 0 THEN
llOK = .T.
ELSE
WITH this.oBiz
MESSAGEBOX(.cErrMsg,.nErrBtns,.cErrTitle) && echo problems encountered
by BizObj
llOK = .F. && <--- this line isn't necessary since by default llOK is
.F., but would you include it for good style?
ENDWITH && this.oBiz
ENDIF && this.oBiz.GetKey(tcSomeValue) > 0
--
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.