Hello --

On Tue, 2 Jul 2002, Philip Mak wrote:

> On Tue, Jul 02, 2002 at 07:30:23AM +0900, MIcha wrote:
> > that seems not to work: (it' ported from perl to ruby:-)
> >
> > x = max_x if --x == 0;
> >
> > the variable x is never decremented.
> > why?
>
> I believe the above code is semantically equivalent to this:
>
> if --x == 0
>     x = max_x
> end
>
> or this:
>
> if x - 1 == 0
>     x = max_x
> end
>
> The statement "x = max_x" overwrites the effect that "--x" had.

Which is none :-)

Ruby doesn't have -- or ++ operators.  --x means negative negative x
(in other words, x).


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav