C
Clayton Lane
I'm new to Ruby and unsure how to delete numbers in an array. I have an
array filled with numbers from 1 to 100. If I use nums.delete_if {|x| x
== 9 }, it will delete 9, but I want to remove any number containing 9.
For example, 19, 39, 92, 99 etc. I tried using a wildcard, but it didn't
work. I'm sure theres an easy command to do it, but I wasn't able to
find it on in Ruby documentation. I also want to remove numbers
containing 0,6,7, and 8 as well. Any help would be greatly appreciated.
Thanks!
array filled with numbers from 1 to 100. If I use nums.delete_if {|x| x
== 9 }, it will delete 9, but I want to remove any number containing 9.
For example, 19, 39, 92, 99 etc. I tried using a wildcard, but it didn't
work. I'm sure theres an easy command to do it, but I wasn't able to
find it on in Ruby documentation. I also want to remove numbers
containing 0,6,7, and 8 as well. Any help would be greatly appreciated.
Thanks!