Bra*_*ert 19
Perl6.链式比较运算符:
if( 2 <= $x <= 5 ){
}
Run Code Online (Sandbox Code Playgroud)
智能匹配运营商:
if( $x ~~ 2..5 ){
}
Run Code Online (Sandbox Code Playgroud)
结:
if( $x ~~ any 2..5 ){
}
Run Code Online (Sandbox Code Playgroud)
给/当运营商:
given( $x ){
when 2..5 {
}
when 6..10 {
}
default{
}
}
Run Code Online (Sandbox Code Playgroud)
Adn*_*nan 12
在Perl中:
if( $x >= lower_limit && $x <= upper_limit ) {
# $x is in the range
}
else {
# $x is not in the range
}
Run Code Online (Sandbox Code Playgroud)
jcr*_*ey3 11
在bash中:
$ if [[ 1 -gt 2 && 1 -lt 5 ]]; then echo "true"; fi
$ if [[ 3 -gt 2 && 1 -lt 5 ]]; then echo "true"; fi
true
Run Code Online (Sandbox Code Playgroud)
hil*_*llu 10
该智能匹配运营商可以在Perl 5.10,太:
if ( $x ~~ [2..5] ) {
# do something
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31618 次 |
| 最近记录: |