Operator Expressions
If you enclose a string in backquotes (sometimes called backticks), or use the delimited form prefixed by %x, it will (by default) be executed as a command by your underlying operating system.
1.8 In Ruby 1.8, the value of the assignment is always the value of the parameter; the return value of the method is discarded.
Any value that is not nil or the constant false is true.
=== Used to compare the each of the items with the target in the when clause of a case statement.
eql? True if the receiver and argument have both the same type and equal values. 1 == 1.0 returns true, but 1.eql?(1.0) is false.
equal? True if the receiver and argument have the same object ID.
The operators and, or, && and || actually return the first of their arguments that determine the truth or falsity of the condition. Sounds grand.What does it mean?
Take the expression “val1 and val2”. If val1 is either false or nil, then we know the expression cannot be true. In this case, the value of val1 determines the overall value of the expression, so it is the value returned. If val1 has some other value, then the overall value of the expression depends on val2, so its value is returned.
You can get even terser and use a colon ( : ) in place of the then.
break terminates the immediately enclosing loop; control resumes at the statement following the block. redo repeats the loop from the start, but without reevaluating the condition or fetching the next element (in an iterator). next skips to the end of the loop, effectively starting the next iteration.
The redo statement causes a loop to repeat the current iteration. Sometimes, though, you need to wind the loop right back to the very beginning. The retry statement is just the ticket. retry restarts any kind of iterator loop.
分享到:
相关推荐
Programming Ruby - The Pragmatic Programmer's Guide, 2nd Edition (2005) [annotated]
Programming-Ruby-1.9一书中的源代码
Programming ruby ruby编程入门书籍,简要讲解ruby的下载,安装,以及简单的使用。
Programming Ruby中文版第二版[高清扫描版][带书签]。 Programming.Ruby-2nd[高清文字版][带
Programming_ruby-2nd.pdf 全英文书籍。。。。。。。
With active user groups formed in the world’s major cities and Ruby-related conferences filled to capacity. Ruby-Talk, the primary mailing list for discussion of the Ruby language, climbed to an ...
Ruby学习资料(含参考手册和Programming Ruby)-中文.rar
著名的The Pragmatic Programmer一书作者的又一力作,绝对值得珍藏。
The Ruby Programming Language - Oreilly.pdf
Programming Ruby, Ruby程序设计
Programming Ruby 2.0 1.9 pdf
Programming Ruby 1.9 (3rd edition)和源码
Programming ruby.pdf 英文的,不过觉得读起来不吃力,习惯就好了,程序员如果不习惯读英文,会错过非常多的好书
Programming Ruby 第二版(Second Edition)英文版于2005年出版,之后有了中文版。但可惜的是网上流传的中文版PDF基本上都是扫描版的,文字内容得自己打出来,看到好的代码也得自己动手,无法Ctrl-C + Ctrl-V,还...
内含以下4个文档: 1、Addison.Wesley.The.Ruby.Way.2nd.Edition.Oct.2006.chm 2、O'Reilly.Learning.Ruby.May.2007.chm 3、Programming Ruby 2e.pdf 4、ruby中文文档.chm
Programming Ruby English version and the source Code
Ruby-Functional-Programming, 来自 Conferencia Rails 2011 通过 Arnau Sanchez实现的ruby 函數式程式設計簡介理論部分Ruby的函數式程式設計不要更新變數不要重用變量用阻止作為高階函數物件導向與函數式程式設計萬...
PROGRAMMING+RUBY中文版 PROGRAMMING+RUBY中文版 PROGRAMMING+RUBY中文版
Programming Ruby中文版 (第二版).pdf part1(有4部分)