[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: i+++j
From: |
Ben Abbott |
Subject: |
Re: i+++j |
Date: |
Wed, 29 Feb 2012 16:01:35 -0500 |
On Feb 29, 2012, at 3:48 PM, Muhali wrote:
> In pushing my math limits, I stumbled upon
>
> i+++j
>
> octave apparently does this:
>
> octave:> i=j=0
> i = 0
> octave:> k=i+++j; disp([i j k]) ;
> 1 0 0
> octave:> k=i+++j; disp([i j k]) ;
> 2 0 1
>
> that is, doing first i++ and then adding j which always remains 0. It could
> be the other way round (leaving i and increasing j). So, is there a
> rationale for this, and should it not be as in matlab which does nothing,
> not even complain, no matter how many additional +'s are used?
>
Octave is working as intended. The following is parsed the same way.
i=j=0
i = 0
j
j = 0
k = (i++) + j; disp ([i j k]) ;
1 0 0
k = (i++) + j; disp ([i j k]) ;
2 0 1
Ben
- i+++j, Muhali, 2012/02/29