Append list_left (array), list_right (array)

Returns a new list with the same elements as the first list with the elements of the seccond list attached to the right.

# Example 1

puts append (ring 0, 1, 2), (ring 3, 4, 5) #=> (ring 0, 1, 2, 3, 4, 5)

# Example 2

foo = (ring)  #create empty ring foo

n0 = 0  #creating variables for fibonacci calculation
n1 = 1
n2 = 0

7 times do
  foo = append foo, (ring n1)  #appending number to foo

  n2 =  n0 + n1  #calculating next number in sequence

  n0 = n1  #shifting down the calculation numbers
  n1 = n2

end

puts foo  #=> (ring 1, 1, 2, 3, 5, 8, 13)

Hey @Loopiloop,

If you haven’t seen already, you can use + to create a concatenated ring - does this fit your use case?

(ring 0, 1, 2) + (ring 3, 4, 5) # (ring 0, 1, 2, 3, 4, 5)

2 Likes

Yes. I should have informed myself better before making this topic