17 lines
825 B
Text
17 lines
825 B
Text
```doc
|
|
# GreaterOrEqual
|
|
|
|
Values which implement the `>=` infix operator must implement this protocol.
|
|
|
|
If the value also implements the `Greater` and `Equality` protocols then this protocol can be automatically implemented.
|
|
```
|
|
protocol GreaterOrEqual, requires: Greater + Equality, as: do
|
|
```doc
|
|
Compare `self` and `other` returning a boolean.
|
|
|
|
The default implementation delegates to the `Greater` and `Equality` protocols, however you should probably implement this function as a single comparison is more than likely much faster.
|
|
```
|
|
def greater_or_equal?(self: Greater, other: Any): Boolean, when: Greater.greater?(self, other), as: true
|
|
def greater_or_equal?(self: Equality, other: Any): Boolean, when: Equality.equal?(self, other), as: true
|
|
def greater_or_equal?(_self: Self, _other: Any), as: false
|
|
end
|