0

want to check whether d operand is even number

a = 42 b = 8 c = 20 d = 4 if a > 7 && b < 11 && c == 20 && d???? puts "Statement is correct." end

9th Apr 2020, 7:26 AM
kp kalia
kp kalia - avatar
1 Resposta
+ 1
you can use the even? method: 'd.even?' returns true if d is even else false. or the traditional way 'd%2==0' , d is even if remainder of its division by two is null.
9th Apr 2020, 7:40 AM
John Robotane
John Robotane - avatar