Skip to main content

is_odd

Function is_odd 

Source
pub const fn is_odd(value: u64) -> bool
Expand description

Returns whether value leaves a remainder of one when divided by two.

ยงExamples

use use_arithmetic::is_odd;

assert!(is_odd(7));
assert!(!is_odd(12));
Examples found in repository?
examples/basic_usage.rs (line 11)
6fn main() {
7    assert_eq!(gcd(54, 24), 6);
8    assert_eq!(lcm(6, 15), 30);
9    assert!(is_divisible_by(84, 7));
10    assert!(is_even(12));
11    assert!(is_odd(7));
12    assert_eq!(div_floor(-7, 3), -3);
13    assert_eq!(mod_floor(-7, 3), 2);
14    assert_eq!(checked_add(u8::MAX, 1), None);
15    assert_eq!(saturating_add(u8::MAX, 1), u8::MAX);
16    assert_eq!(wrapping_mul(200_u8, 2), 144);
17}