Maths
isOdd

🔢 Checks if a number is odd.

Syntax

import { isOdd } from '@opentf/std';
 
isOdd(n: number): boolean

Parameters

  • n: The number to check.

Returns

true if the number is odd, false otherwise.

Examples

isOdd(0) //=> false
 
isOdd(1) //=> true
 
isOdd(2) //=> false
 
isOdd(-1) //=> true
 
isOdd(-2) //=> false

Related

Try