摘要:
def do_n_times(n){ i = 1 while( i#{x}" }# --->1# --->2# --->3上面是使用关键字 yeild 来调用代码块,而下面的例子,在方法定义的时候定义了一个Proc 参数( 索引到传入的块),这个 Proc 参数需放在参数列表的最后,然后在方法里... 阅读全文
摘要:
def hello # A nice simple method puts "Hello World" # Suppose we want to augment it...end alias original_hello hello # Give the method a backup named... 阅读全文