Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def select(arr)
- arr.each do |elem|
- if yield elem
- puts elem
- end
- end
- end
- select([1, 5, 7, 2, 4, 6]) do |elem|
- elem % 2 == 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement