Pattern: next
without accumulator
Issue: -
Don't omit the accumulator when calling next
in a reduce
block.
# bad
result = (1..4).reduce(0) do |acc, i|
next if i.odd?
acc + i
end
# good
result = (1..4).reduce(0) do |acc, i|
next acc if i.odd?
acc + i
end