From: Thomas Preymesser Date: 2013-02-11T22:04:28+09:00 Subject: Re: firtst and only element of array (noob level) --f46d04083f2db2a97e04d57227b5 Content-Type: text/plain; charset=ISO-8859-1 Am 11.02.2013 13:27 schrieb "Ronnie Aa" : > > Hello people, > > Lets say i have > arr = [100] > and > i = 100 > > Now i do calculation: > i * arr[0] ==> 10000 # works ok > but > i * arr ==> Error > > Why arr != arr[0] with only one element in the array? arr is the whole Array object and arr[0] is the first element of the array (= 100) and these are not equal. --f46d04083f2db2a97e04d57227b5 Content-Type: text/html; charset=ISO-8859-1


Am 11.02.2013 13:27 schrieb "Ronnie Aa" <lists@ruby-forum.com>:
>
> Hello people,
>
> Lets say i have
> arr = [100]
> and
> i = 100
>
> Now i do calculation:
> i * arr[0] ==> 10000 # works ok
> but
> i * arr ==> Error
>
> Why arr != arr[0] with only one element in the array?

arr is the whole Array object and arr[0] is the first element of the array (= 100) and these are not equal.

--f46d04083f2db2a97e04d57227b5--