On 23.7.2008, at 18.26, Crippy wrote:
>
> HI I'm an RoR newbie. I'm trying to execute the following code but am
> getting the error in the subject line at line five.
>
> Array = ["Hello", "there", "sweetie", 1, 2, 3]
You're basically overwriting the constant Array (which normally points
to the Array class) here. Variable names always start with lowercase,
constants upper. That's why Array doesn't have a method new anymore
after that. Ruby is case-sensitive.
//jarkko
>
> puts Array[0]
> puts Array[1]
> puts Array.length
> Array2 = Array.new
> puts array2.length
> Array2[0] = "Banana"
> Array2[1] = "fish"
> puts array2[0] + " " + array2[1]
> puts array2.length
>
> Any help would be greatly appreciated!
>
> >
--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi