2 ms·
subset OneToTen of Int where 1..10; Why make it more complicated? :-) The secret is that given values are smartmatched against the given object. And the val
by lizmat 3y ago
subset OneToTen of Int where 1..10;
Why make it more complicated? :-)
The secret is that given values are smartmatched against the given object. And the values 1 through 10 will return True if smartmatched against the 1..10 Range object. The `of Int' ensures that only integer values are allowed, otherwise 3.14 would also match. Unless of course, that is what you intended. In which case you can omit the "of Int".
- frou_dh 3y agoRaku seems very cool - absolutely stuffed with gems like this to learn.