Hi,
In message "Re: Array.last Weirdness"
on 02/01/24, Yukihiro Matsumoto <matz / ruby-lang.org> writes:
||Where's the variable here? [-1] points to the last item in the array, as
||.last does; no?
|
|a[-1]+=' bar' means a.[]=(-1,' bar')
Oops, I meant
a.[]=(-1,a[-1]+' bar')
in other words
a[-1] = a[-1] + ' bar'
matz.