At first I wasn't sure if the += and -= operators wouldn't work, so I checked in the manual. But they're not there!
However, they do work (because they didn't show a compile error and I used Display checks). So how come they're not a part of the manuals entry on all of the other operators? There's even the bitwise ones included.
~Trent
PS-This seems like a Beginner question, so I posted here.
[Edit]: Requesting that this gets moved to the tech to become an official suggestion.
I can't say for sure why the += and -= shortcut operators aren't included in the documentation (but yet, as you say, the binary operators are...).
Definitely I'd say it would be useful for new members to know about.
It is notable that at the moment there are no *=, /=, or %= operators however.
As for the forum, I'd say that as a "suggestion" maybe the Tech Forum would've been a better fit? I'd say it's a toss-up, but don't cross-post. If needed the moderators can make sure it's in the right place. ;)
While we're talking about these, I have often noticed the lack of *= and /* respectively and thus would welcome their addition. Can't imagine it can be much of a time investment to implement them?
They do get explained in the manual: scripting turorial 1 ;)
what do *=, /=, or %= operators do? i've never seen them before
int a, b;
a += b; // is the same as a = a + b
a -= b; // is the same as a = a - b
a *= b; // is the same as a = a * b
a /= b; // is the same as a = a / b;
a %= b; // is the same as a = a % b;
I personally never saw a use for %= though.
Quote from: dkh on Tue 11/11/2008 16:13:29
I personally never saw a use for %= though.
// Make x position wrap around at screen edge
x++;
x%=System.Viewport_Width;
I should have phrased that better, I know what it does and when it's useful, it's just that I really use the remainder operator % so rarely that it's not a big hassle to type in the few more characters. I use *= and /= often though!
Of course, if Chris implements *= and /=, it wouldn't be a problem (I suspect this should be pretty easy to get into AGS) to just add the %= as well, at the very least for consistency's sake!