#############################################
##閉包的一個(gè)用法
animals = %w( ant bee cat dog elk ) # create an array
animals.each {|animal| puts animal } # iterate over the contents
#############################################
def call_block
puts "Start of method"
yield ##執(zhí)行傳入的參數(shù).這里為"In the block"
yield
puts "End of method"
end
call_block { puts "In the block" }
##############################################