#!/usr/bin/ruby func Accumulator(sum) { func(num) { sum += num }; } var x = Accumulator(1); x.call(5); Accumulator(3); say x.call(2.3); # prints: 8.3