Ruby_特殊语法糖_Range和if
题目:
irb(main):025:0> if( 3 .. nil)irb(main):026:1> puts 100irb(main):027:1> end100=> nilirb(main):028:0> 3 .. nilArgumentError: bad value for rangefrom (irb):28from :0irb(main):029:0>
?
关闭:
?
If range expression appears in any other place than conditional expression, it returns range object from left hand side to right hand side.
?
If range expression appears in conditional expression, it gives false until left hand side returns true, it stays true until right hand side is true. .. acts like awk, ... acts like sed.
?
参考:ruby的语法:
http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/syntax.html
?
?
====END====
====END====
====END====
+++