When creating an array in Ruby one thing you might want to do is to get the length of that array. In most other programming languages this can be a rather drawn out affair. However, this is not the case with ruby. Getting the length of an array is a snap. First enter into irb at the command line and set up your array as shown below:
my_array = ['element1','element2','element3']
Now you get the length of the array by simply by adding the 'length' operator onto your array.
Now hit enter to get the result:
And that's all there is to getting the length of an array in Ruby.