|
David,
I'm not 100% sure compound assignment operations are allowed in evals
... but regardless, try using "+=" instead of "=+" (although I'm notIt does make a difference. Consider:
sure it makes a difference).
x=+1;
x+=1;
The first sets x to positive 1; the second increments x by 1. Perhaps move
obvious:
x=-1;
x-=1;
The use of += over repeating the variable name (x+=1 vs x=x+1) seems to be a
personal coding style preference. When dealing with a very short variable
name (like x) then I don't much care because it is still obvious at a glance
the same variable name is mentioned on both sides of the equal sign. When
dealing with longer variables names, particularly cryptic names which don't
"read well", I prefer the += notation for the same reason I prefer to leave
Factor 1 blank in fixed format arithmetic. You don't have to examine the
names to make sure they are spelled exactly the same.
Ironically, long variable names which are "readable" are nearly as easy to
identify as being identical as very short names like x. The problem tends
more to be abbreviated field names from record formats or "legacy" code
converted to free format.
Doug
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.