How to remove an item from an array by index in Ruby

1 Answer

0 votes
arr = ["a", "b", "c", "d", "e"]

index = 1
arr.delete_at(index)

puts arr.join(", ")





#
# run:
# 
# a, c, d, e
# 

 

 



answered Mar 1, 2023 by avibootz

Related questions

1 answer 203 views
1 answer 236 views
1 answer 224 views
1 answer 192 views
1 answer 221 views
2 answers 367 views
1 answer 211 views
...