ruby-uebungen/Assignment_020/solution
Thomas Smits 58bc23516c Update of exercises 2023-05-25 17:49:42 +02:00
..
readme.md Update of exercises 2023-05-25 17:49:42 +02:00

readme.md

Lösung: Callback mit Proc

def rechner(a, b, lam = nil, &block)
  lam ||= block
  ergebnis = lam.call(a, b)
  ergebnis * 2
end

lam = ->(a, b) { a + b }
puts rechner(5, 4, lam) # -> 18