MLUG: Re: [MLUG] Quick programming question on style
Re: [MLUG] Quick programming question on style
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
This is a good idea but if I am going to check for a RC that should be a value of one (1) or zero (0) then I just do this:
if (testcase) {




Personally I use the first style, but switch it to:

   if (1 == testcase) {

That way if you make the common mistake of using a '=' instead of an
'==' you'll get a compiler error. I have no idea where I first liearned
this but I tend to use it in any langugae. Putting the constant on the
left side of the comparison prevents accidentally assigning a value to
the variable.


_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members