× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The assignment operators are =. +=, -=, *=, ^=, and **= - in all of them, the equal sign is last - don't know if a space would break them - haven't even thought to try that!!. As you point out, the other combinations are 2 separate operators - the assignment equal and a unary operator.

You can't do the others in a reverse order - syntax error.

I believe the assignment compound operators came in around v5r2.

Vern

On 10/3/2010 4:23 PM, Douglas Handy wrote:
David,

I'm not 100% sure compound assignment operations are allowed in evals
... but regardless, try using "+=" instead of "=+" (although I'm not
sure it makes a difference).

It does make a difference. Consider:

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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.