passing a lambda to each
my_lambda = ->(x) { puts x } my_arr = [ 1, 2, 3, 4 ] my_arr.each(&my_lambda)