ruby-uebungen/Assignment_021/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: Closure

def create_counter
  n = 0 # closure
  Proc.new { n += 1 }
end

p = create_counter
puts p.call # -> 1
puts p.call # -> 2