Trait in prelude::ops auto-imported

Ge

trait Ge<T>
Source: compiler/src/builtin_docs/prelude/ops.hy

The greater-or-equal operator >=.

a >= b on a type with a Ge instance calls ge(a, b).

Required methods#

NameDescription
geReturns true when a is greater than or equal to b.

Examples#

use tests::assert;
class Version {
    pub n: int,
}

impl Ge for Version {
    pub fn ge(Version a, Version b) -> bool {
        return a.n >= b.n;
    }
}

fn main() {
    assert!(new Version(2) >= new Version(1));
}

See also#

  • Add: The addition operator +.
  • Sub: The subtraction operator -.
  • Mul: The multiplication operator *.
  • Div: The division operator /.
  • Neg: The unary negation operator -x.
  • Rem: The remainder operator %.
  • Pow: The exponentiation operator **.
  • Num: The numeric bundle: Add, Sub, Mul, Div, Neg, Rem and Pow.
↑ ↓ navigate ↵ open