We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20c40c5 commit dec27a8Copy full SHA for dec27a8
module.rb
@@ -79,7 +79,7 @@ def my_inject(a=nil,b=nil)
79
return final
80
end
81
82
- final = 1 if yield(final, self[0]) == 0 || yield(final, self[1]) == 0 if self[1] != nil if block_given?
+ final = 1 if yield(final, self[0]).zero? || yield(final, self[1]).zero? if !self[1].nil? && block_given?
83
my_each { |x| final = yield(final, x) } if block_given?
84
return final if block_given?
85
0 commit comments