Home 24. ..=X
Post
Cancel

24. ..=X

As of 1.66, it is possible to use ..=X in patterns

1
2
3
4
5
6
let result = 20u32;

match result {
    0..=20 => println!("Included"),
    21.. => println!("Sorry"),
}
This post is licensed under CC BY 4.0 by the author.