want to check whether d operand is even number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answer
+ 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