method i8.signum
-1, 0 or 1 for a negative, zero or positive value.
Example:
fn main() io {
let neg: i8 = -5
let zero: i8 = 0
let pos: i8 = 9
print("{neg.signum()} {zero.signum()} {pos.signum()}")
}Output
-1 0 1
pub(api) fn signum() -> i8Complexity. O(1).
Since. 1.0.0-beta
Returns
i8
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/numbers.oxl:1288