Bill Allombert on Fri, 23 May 2003 11:35:12 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Unorthodox behaviour


On Fri, May 23, 2003 at 10:04:33AM +0100, Jon Perry wrote:
> ? x=4
> %1 = 4
> ? print(++x)
>   ***   unexpected character: print(++x)
>                                      ^---
> 
> ? print(x++)
> 5
> ? x
> %2 = 5

This is documented. GP understand x++ and treat it as C ++x, but it
does not know about ++x.

? ??"GP operators"@2
...
   * Priority 10

   ++ and -- (unary, postfix): x++ assigns the value x+1 to x, then returns the
new value of x.  This corresponds to the C statement ++x (there is no prefix ++
operator in GP). x-- does the same with x-1.

Cheers,
Bill.