[chuck-users] ++ return value

Atte André Jensen atte.jensen at gmail.com
Thu Jun 22 04:22:58 EDT 2006


Hi

I expected the ++ (and --) operator to work as this:

If ++ precedes the variable, e.g. ++i, the value returned is the value 
in counter after it has been incremented. If ++ follows the variable, 
e.g. i++, the value returned is the value in counter before it has been 
incremented.

This doesn't seem to be the case (chuck always returns the value after 
it has been incremented):

int i;
<<<i>>>;
<<<i++>>>;
<<<++i>>>;

[atte at aarhus tests]$ chuck increment.ck
0 :(int)
1 :(int)
2 :(int)

Maybe this could be changed?

-- 
peace, love & harmony
Atte

http://www.atte.dk      | quartet:      http://www.anagrammer.dk
http://www.atte.dk/gps  | compositions: http://www.atte.dk/compositions


More information about the chuck-users mailing list