Answers for "ruby select"

1

ruby select

# A new array containing all elements of array for which the given block returns a true value.

# Ruby code for select() method

# declaring array
a = [18, 22, 33, 3, 5, 6]

# select
puts "select method : #{a.select {|num| num > 10 }}\n\n"

# output
# select method : [18, 22, 33]
Posted by: Guest on May-25-2021

Code answers related to "ruby select"

Browse Popular Code Answers by Language