Answers for "ruby remove value from array"

5

ruby remove element from array by value

a = [3, 2, 4, 6, 3, 8]
a.delete(3)
Posted by: Guest on February-03-2020
2

ruby remove value from array

# Altering the array:
a = [3, 2, 4, 6, 3, 8]
a.delete(3)
#=> 3
a
#=> [2, 4, 6, 8]

# Creating new array:
b = [3, 2, 4, 6, 3, 8]
b - [3]
#=> [2, 4, 6, 8]
b
#=> [3, 2, 4, 6, 3, 8]
Posted by: Guest on June-07-2020

Code answers related to "ruby remove value from array"

Browse Popular Code Answers by Language