IsOdd
Returns true if the given number is odd, false otherwise.
- Checks whether a number is odd or even using the modulo (
%) operator. - Returns
trueif the number is odd,falseif the number is even.
func IsOdd(n int) bool {
return n % 2 == 1
}IsOdd(3) // true