Trait in prelude::ops auto-imported

Gt

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

The greater-than operator >.

a > b on a type with a Gt instance calls gt(a, b).

Required methods#

NameDescription
gtReturns true when a is greater than b.

Examples#

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

impl Gt for Version {
    pub fn gt(Version a, Version b) -> bool {
        return a.n > b.n;
    }
}

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

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