[chuck-users] ++ return value
nitro2k01 at gmail.com
Wed Jun 28 08:19:52 EDT 2006
The advantage of using the ++ and -- operators is that you can change
the value of one variable and then further use it in an expression.
++i +=> x;
This command will increment i, then take the incremented value and add
to x. In many situations, the ++/-- operators lets you write compact
yet readable code. Consider these C statements:
They all do the exact same thing, but at least in my experienced eyes,
I know which one reveals most clearly what is going on.
On 6/28/06, Kassen <signal.automatique at gmail.com> wrote:
> Hi, Ge!
> > The ++ and -- (post and pre) are a bit fishy right now. We plan to fix
> > this.
> > In the meantime, it safest to NOT used them inline with expressions.
> I wondered about those.
> Why would you use those instead of "+=>" or "-=>"? I don't realy see
> why we need those at all, personally I avoid them beause to me using
> the ChucK operator feels more consistend.
> Sorry if I'm missing something; clearly this is another thing borowed
> from C which I don't speak but I'd still like to know WHY we borowed
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
-----BEGIN 2ROT13 MESSAGE-----
The blog of nitro2k01: <http://soundandcomplete.wordpress.com/>
Sätt på ett par flipflops, vippa på rumpan
och gör det här till en minnesvärd sommar!
-----END 2ROT13 MESSAGE-----
More information about the chuck-users