method i32.checked_div
Checked division (truncating toward zero): the quotient, or none on division by zero and on MIN / -1, whose quotient does not fit.
Example:
fn main() io {
print("{(7 as i32).checked_div(2)} {(7 as i32).checked_div(0)}")
}Output
3 none
pub(api) fn checked_div(o: i32) -> i32?Complexity. O(1).
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
o | i32 |
Returns
i32?
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/numbers.oxl:416