[REBOL] Re: Bug or feature ?
From: arolls:bigpond:au at: 11-Jan-2001 14:28
> >>items: [i1 7 i2 555] ;ok
> >>items/i1 + 55 ; ok
> >>items/i1: 4 + 12 ; ERROR, (items/i1: 4) returns block, not integer
>
> Should not > items/i1: 666 < behave like > items/i1 < ?
When you set an element of a block, the element is changed,
and then the block is returned (as Andrew said, for reuse.)
When you get an element of a block, only the element is returned.
In this line,
items/i1: 4 + 12
This happens first;
items/i1: 4 <- it returns the altered block.
Then this;
+ 12 <- trying to add 12 to the block. Error.
That's because rebol evaluates from left to right.
To fix, use parentheses.
items/i1: (4 + 12)
Anton.