Returns true
if the given number is even, false
otherwise.
Checks whether a number is odd or even using the modulo (%
) operator.
Returns true
if the number is even, false
if the number is odd.
代码实现
bool isEven(num n) {
return n % 2 == 0;
}
使用样例
isEven(3); // false