mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
14 lines
208 B
Nim
14 lines
208 B
Nim
type
|
|
Comparable = concept a
|
|
(a < a) is bool
|
|
|
|
proc myMax(a, b: Comparable): Comparable =
|
|
if a < b:
|
|
return b
|
|
else:
|
|
return a
|
|
|
|
doAssert myMax(5, 10) == 10
|
|
doAssert myMax(31.3, 1.23124) == 31.3
|
|
|