René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

yield [Ruby]

def call_block

 #yield "One"                   # nicht erlaubt
  yield "Hello", "World"
  yield "Un", "Dos", "Tres"     # erlaubt, obwohl 1 Parameter zu viel

end

call_block { | first_arg , second_arg | puts first_arg + " " + second_arg } 
def call_block(n)

  n.times do |i|
    yield i
  end

end

call_block(5) { | arg | puts "arg is: " + arg.to_s }