+= not allowed?



I see sample code with target += … everywhere, but when I used this syntax in my custom function, I keep getting parsing error

58: 	    real sumExt;
59: 	    sumExt += 1.0;

Is this possible? that target += is allowed, but not else where?


Correct. Until 2.17.x


target isn’t a variable of the usual kind and target += is a specialized statement. As @bgoodri says, it will be avaiablle for all ordinary variables in Stan 2.17 (probably not out for two or three months).