🔢 Checks if a number is odd.

Syntax

TypeScript
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

TypeScript
isOdd(0) //=> false

isOdd(1) //=> true

isOdd(2) //=> false

isOdd(-1) //=> true

isOdd(-2) //=> false
Last updated on
Edit this page