def up_array(arr) ((arr.join.to_i) + 1).to_s.chars.map(&:to_i) unless arr.any?{ |i| i < 0; return nil}end p up_array([5, 7, 7])
Standard input is empty
nil
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!