parameter: block
return: an instance of class Proc
Proc:
procedure
method:
call:
tell proc to do sth
ex:
test = lambda { |i| i + 1 }
test.call(2)
--> 3
the method to pass parameters
1. test.call(2)
2. test[2]
another method to create Proc:
Proc.new { }
沒有留言:
張貼留言