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