8969b3dc2e4211b514c08ee9879bb0c4

an array within array iteration
break and give nil if a value greater then zero is found
want to ignore the first value in second array
possilby improve with use of blocks?

y_max = 10

arr_data.each do |arr|
  arr.each do |e|
    if not arr.first == e #ignore first element
      y_max = nil && break if e > 0 #it is not zero
    end
  end
end

Refactorings

No refactoring yet !

A8d3f35baafdaea851914b17dae9e1fc

Adam

September 12, 2009, September 12, 2009 14:35, permalink

No rating. Login to rate!
y_max = data.any? { |elements| elements[1..-1].any? { |element| element > 0 } } ? nil : 10

Your refactoring





Format Copy from initial code

or Cancel