How to script a comparison of a number against a range?
1 is not within 2-5
or
3 is within 2-5
Perl6
.Chained comparison operators:
if( 2 <= $x <= 5 ){
}
Smart-match operator:
if( $x ~~ 2..5 ){
}
Junctions:
if( $x ~~ any 2..5 ){
}
Given / When operators:
given( $x ){
when 2..5 {
}
when 6..10 {
}
default{
}
}