Ruby - Functional Patterns in Ruby
What will this code output?
enum = (1..10).lazy.map { |x| x * 2 }.select { |x| x > 10 }.force
p enumenum = (1..10).lazy.map { |x| x * 2 }.select { |x| x > 10 }.force
p enum.force usage.force converts lazy enumerator to an array, so enum is the filtered array.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions