4 ms·
Nim[0] supports subrange types: type Foo = range[1 .. 10] Bar = range[0.0 .. 1.0] # float works too var f:Foo = 42 # Error: cannot convert
by archargelod 1y ago
Nim[0] supports subrange types:
type
Foo = range[1 .. 10]
Bar = range[0.0 .. 1.0] # float works too
var f:Foo = 42 # Error: cannot convert 42 to Foo = range 1..10(int)
var p = Positive 22 # Positive and Natural types are pre-defined
[0] - https://nim-lang.org/docs/manual.html#types-subrange-types https://nim-lang.org/docs/manual.html#types-subrange-types