https://gist.github.com/jamashita/547e6f5d880acfdcb0de891d02d309ad#file-iversion-ts-L7
- Deno
| #!/bin/bash | |
| OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 deno run -A sample.ts |
| export interface IVersion<T extends IVersion<T>> { | |
| // greater than | |
| gt(other: T): boolean; | |
| // greater than or equals | |
| gte(other: T): boolean; | |
| // less than | |
| lt(other: T): boolean; | |
| // less than or equals | |
| lte(other: T): boolean; | |
| // equals |
| export interface IVersion<T extends IVersion<T>> { | |
| // greater than | |
| gt(other: T): boolean; | |
| // greater than or equals | |
| gte(other: T): boolean; | |
| // less than | |
| lt(other: T): boolean; | |
| // less than or equals | |
| lte(other: T): boolean; | |
| // equals |
| #! ruby -Ks | |
| #coding:windows-31j | |
| STDOUT.sync = true | |
| p "入力+1します" | |
| p "#{Integer(gets).succ}" |
| class Hoge | |
| include Comparable | |
| attr_accessor :age | |
| def initialize(age) | |
| @age = age | |
| end | |
| def <=>(other) | |
| self.age <=> other.age |