That code block does nothing but increment the value of the local variable and return it.
代码段做的事就是增加本地变量的值并返回。
The respond_to method accepts a single code block and passes one instance variable (labeled wants) into the code block.
respond _ to方法接受单个代码块,并传递一个实例变量(标为wants)到代码块。
Call with continuation gives you a code block, and the continuation (or a saved call stack, with instance variables), which you assign to a variable.
用continuation进行调用使您获得一个代码块和指派给变量的continuation(或已保存的调用堆栈,其中有实例变量)。
While no one would ever directly use the idiom in Listing 1, this code is very similar to the case where the lock associated with a synchronized block can be proven to be a thread-local variable.
虽然没有人会直接使用清单1中的形式,但是与这个代码非常类似的情况是:可以证实与synchronized块关联的锁是一个线程本地变量。
puts a In Ruby 1.8, this code prints "42", because the block variable a is actually the same a of the containing scope.
putsa在Ruby 1.8中,这段代码会打印出“42”,因为块变量a和所包含域中的a就是一个变量。
I'm using Groovy's syntactic sugar to execute a code block, which is to place a set of parentheses adjacent to the code block's variable.
我使用了Groovy的语法糖(syntactic sugar)来执行此代码段,结果放置在代码段变量旁边的圆括号中。
The code here USES a local variable diff, which is only defined within this block of code, while later in the constructor a separate variable, fill, is declared at the same level.
这里的代码使用了一个局部变量diff,这个局部变量只定义在这一块代码范围内,之后在构造函数中又声明了另一个相同级别的变量fill。
Some changes, such as renaming a variable to a more fitting name or moving a block of code into a new function, make the code easier to understand.
某些更改,如重命名为更多的调整名称变量,或移动到一个新的函数的代码块的使代码更易于理解。
In recursive code, a static object or variable is guaranteed to have the same state in different instances of a block of code.
在递归代码中,一个静态的对象或者变量将被确保在一个代码块的不同实例间保持相同的状态。
In recursive code, a static object or variable is guaranteed to have the same state in different instances of a block of code.
在递归代码中,一个静态的对象或者变量将被确保在一个代码块的不同实例间保持相同的状态。
应用推荐