Replace with
Integer#even?
. 3 b = 2
4 total = 0
5 while total <= 4e6 do
6 if a % 2 == 0 then 7 total += a
8 end
9 c = a + b
Description
Bad practice
if x % 2 == 0
end
Recommended
if x.even?
end
Run summary
Integer#odd?
/Integer#even?
RB-ST1046Integer#even?
. 3 b = 2
4 total = 0
5 while total <= 4e6 do
6 if a % 2 == 0 then 7 total += a
8 end
9 c = a + b
if x % 2 == 0
end
if x.even?
end