ruby append to array
arr = [1, 2, 3, 4, 5]
arr << 6
- Create an array
arr
with elements [1, 2, 3, 4, 5]. - Use the
<<
operator to append the value 6 to the arrayarr
. ```
arr = [1, 2, 3, 4, 5]
arr << 6
arr
with elements [1, 2, 3, 4, 5].<<
operator to append the value 6 to the array arr
.
```