Im confused

Im kind of confused on a few things in ruby…

“Hello”.length(4)
returns l
because H is 1, e is 2, l is 3, and another l is 4
but
my_Array = [1, 2, 3, 4, 5]
my_Array[2]
returns a 3 cause arrays are 0 indexed.
my_Array.count
returns 5

when I use String.length, why does the index not start at 0, but it does with arrays?
Is that even right?

Does it?

AFAIK, you cannot pass an argument to length()

Using Ruby 1.9.3

p "Hello".length(4)
hello.rb:1:in 'length': wrong number of arguments(1 for 0) (ArgumentError)

however:

p "Hello".length
=> 5

Both strings and arrays are zero indexed.

hello = "Hello"
p hello.length
=> 5

array = [1, 2, 3, 4, 5]
p array.length
=> 5

p hello[0]
=> "H"

p array[0]
=> 1

p hello[4]
=> "o"

p array[4]
=> "4"

Its confusing cause hello.length = 5
but hello[4] = o
I guess its best to memorize whenever I use arrays (or array notation), everything starts at 0
whereas the .length things starts counting at 1

You actually just answered your question. length is returning the length of the object.
If it is a string with 5 letters it will return 5. If it is an array with 9 items it will return 9.
Whenever you call on the index of a string (or array) you are calling each element based on its index; which starts with zero.

That means that a string with length = 5 will have indices of 0, 1, 2, 3, 4 (a total of 5)
And a loop would be zero to length minus 1 (a very common construct in most programming languages.