Skip to main content

is_divisible_by

Function is_divisible_by 

Source
pub const fn is_divisible_by(value: u64, divisor: u64) -> bool
Expand description

Returns whether value is evenly divisible by divisor.

This plain helper returns false when divisor is zero. Use checked_is_divisible_by when zero divisors should stay explicit.

ยงExamples

use use_arithmetic::is_divisible_by;

assert!(is_divisible_by(84, 7));
assert!(!is_divisible_by(84, 0));