3 ms·
the `{y:2, x:1..=4}` syntax is confusing, is it really range checking ?
by agumonkey 7y ago
the `{y:2, x:1..=4}` syntax is confusing, is it really range checking ?
- steveklabnik 7y agoYes, it says "match if y is two, and x if it's between one and four, inclusive".
- agumonkey 7y agoWeird couldn't find it in the Book.
- steveklabnik 7y agoWe don't cover this exact combination of features directly in the book; this falls out of composing the "pattern match" feature with the "range" feature. It's also possible that you're reading a version of the book before the ..= syntax was introduced; it hasn't been there since 1.0.