Skip to content

std::ops - Operators

func mul

func mul(T, T): T
where T: number

Multiplies two numbers.

func div

func div(T, T): T
where T: number

Divides two numbers.

func mod

func mod(T, T): T
where T: number

Division remainder.

func add

func add(T, T): T
where T: number

Adds two numbers.

func sub

func sub(T, T): T
where T: number

Subtracts two numbers.

func neg

func neg(T): T
where T: int8 | int16 | int32 | int64 | float32 | float64

Negates a number.

func cmp

func cmp(T, T): Ordering
where T: primitive

Compare two values to determine if the first is less, equal, or greater than the second.

type Ordering

type Ordering: enum {less, equal, greater}

Result of a three-way comparison. Returned by cmp.

func eq

func eq(T, T): bool
where T: primitive

Tests if values are equal. Used by == operator.

func ne

func ne(T, T): bool
where T: primitive

Tests if values are not equal. Used by != operator.

func gt

func gt(T, T): bool
where T: primitive

Tests if left value is greater than the right. Used by > operator.

func lt

func lt(T, T): bool
where T: primitive

Tests if left value is less than the right. Used by < operator.

func gte

func gte(T, T): bool
where T: primitive

Tests if left value is greater or equal to the right. Used by >= operator.

func lte

func lte(T, T): bool
where T: primitive

Tests if left value is less or equal to the right. Used by <= operator.

func and

func and(bool, bool): bool

Tests if both values are true. Used by && operator.

func or

func or(bool, bool): bool

Tests if either of the values is true. Used by || operator.

func not

func not(bool): bool

Inverts a boolean. Used by ! operator.