Arrays work the same as rings in 3.2?

I am making a video for my students about how to use arrays and rings.
I made the following example of an array where I was anticipating it to only play each note in the array once and then produce rests as it went through the remaining number of times since this is the behavior I have seen when using arrays in this way

21.times do
  play [60, 67, 64, 70, 72, 74, 76].tick
  sleep 0.25

However, to my surprise, after playing each note once it went back to the beginning of the array and played all the notes again, just like it would if it was a ring.

Is this a new feature to 3.2? Did I miss something?

Yep, this is new in v3.2. See the release notes:

Calling .tick and .look on a normal array such as [1, 2, 3] will
now automatically convert it to a ring first.

Just to be clear, Arrays are still not the same as Rings. Just that calling .tick on either works similarly (as arrays are automatically converted to rings first).

1 Like

Ok. I figured that’s what it must be.

If you want to make a clear demonstration of the indexing differences of Arrays and Rings, just use the [idx] mechanism for extracting a value at index idx.

[:a, :b, :c][3] #=> nil
(ring :a, :b, :c)[3] #=> :a