Block,Interator............................

# 
# To change this template, choose Tools | Templates
# and open the template in the editor.
 
mystring="aaa"
puts mystring.empty?
class P
def a
yield(ok.empty?)
end
end
class PP
def myclass_b
P.a {|arg|; puts arg}
end
end

class A
def mycool
  yield
end
def mycool_yield
  A.mycool{puts "OK"}
end
  
end
 The "yield" method is just like the "invoke".  But it could do a more little job......

你可能感兴趣的:(block)