Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problem with RANDOM and arrays



2010-01-11 20:13:12 +0000, Stephane Chazelas:
[...]
> Similar problem:
> 
> $ x=0; ((a[++x]++)); echo $x
> 2
> 
> All the +=, -=, *=... operators are also affected.
[...]

Strange, their must be something in my .zshrc that affects the
behavior as I get:

$ zsh -c 'x=0; ((a[++x]++)); echo $x'
1

(same with an interactive zsh -f)

The ((a[RANDOM%2+1]++)) problem shows up in any case though.

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author